You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature Request: const correctness on inputs to algorithms supported properly #353
Is your feature request related to a problem? Please describe the problem.
This may be my misunderstanding but throughout inputs are defined as:
const RealVectorView& input
There is a InputRealVectorView but that's not used (here the pointer is defined as const, rather than the view object). I do think that making the object const probably enforces constness, but it doesn't seem to play nicely with things that are const outside.
I have code where I have a const double* - I wish to pass it as an input, but I currently seem to need a const cast which makes me sad. Might @weefuzzy explain if I've got this wrong, or if constness is enforced, but not fully supported by the expression of things in their current state.
Happy to be told that I've not understood the way to do things
Describe the solution you'd like to see.
Inputs allow creation of views from const pointers
Describe alternatives you've considered
I have considered doing a const cast and also changing the input of the algorithm I want to work with to const InputRealVectorView - I did the later and it works, so it looks like this just needs to be applied everywhere.
Again - maybe I am wrong here...
Additional context
Apparently I must give additional context - it is late here and I am listening to repeated samples of viola whilst they are also resynthesises poorly by driving a sawtooth wave with the yinfft algorithm that I have running in framelib - the last part is probably the relevant context.
I started fixing this at some point with InputRealVectorView (because, yes, all those things should be View<const T>) but it looks like that was just before I moved on and got busy with other things.
I want to work with to const InputRealVectorView - I did the later and it works, so it looks like this just needs to be applied everywhere.
If you have the bandwidth for a PR, it would be gratefully accepted ❤️
Cool - I will set the mighty powers of either the bots, or possibly just find and replace on this. I will double const it, because one can never be too careful.
I did #354 and I have co-pilot "reviewing" it at the moment. It looks like there is automagic conversion between non const pointer views and const pointer views meaning that if changes are correct it is very unlikely to break compilation in calling code, which is good.
Activity
weefuzzy commentedon Nov 9, 2026
I started fixing this at some point with
InputRealVectorView(because, yes, all those things should beView<const T>) but it looks like that was just before I moved on and got busy with other things.If you have the bandwidth for a PR, it would be gratefully accepted ❤️
AlexHarker commentedon Nov 9, 2026
Cool - I will set the mighty powers of either the bots, or possibly just find and replace on this. I will double const it, because one can never be too careful.
AlexHarker commentedon Nov 9, 2026
I did #354 and I have co-pilot "reviewing" it at the moment. It looks like there is automagic conversion between non const pointer views and const pointer views meaning that if changes are correct it is very unlikely to break compilation in calling code, which is good.
weefuzzy commentedon Nov 9, 2026
Cheers, yes – I just did my own local version whilst you were doing that, and have discovered some goodies along those lines.