Pre C++ 11, I often needed to implement two very-alike variants of a method to deal with const and non-const usage scenarios of the class/struct:
struct my_struct_t{
....
float_t& at( uint32_t row, uint32_t col)
{
return *(((float_t*)((uint8_t*)numbers+row*row_stride)) + col);
}
float_t const& at( uint32_t row, uint32_t col) const
{
return *(((float_t*)((uint8_t*)numbers+row*row_stride)) + col);
}
};
Has this changed in C++ 11?