rttrorg / rttr

C++ Reflection Library
https://www.rttr.org
MIT License
3.17k stars 439 forks source link

struct sequential_container_base_dynamic has incorrect signature of non const get_data() member function #242

Open bsviglo opened 5 years ago

bsviglo commented 5 years ago

I've tried to integrate EASTL into my application and noticed strange compiler output that it can't instantiate non const member function of template<typename T> struct sequential_container_base_dynamic. After some research I've managed to understand that problem caused by the fact that EASTL uses just T* (pointer) as an iterator type rather a class which wraps pointer on type (STD uses this wrapper). So in this case compiler produces the same output for const and non const version of get_data() functions. So, right now the declaration of them looks like this:

   static value_t& get_data(const itr_t& itr)
    {
        return *itr;
    }

    static const value_t& get_data(const const_itr_t& itr)
    {
        return *itr;
    }

but should be like this

    static value_t& get_data(itr_t& itr)
    {
        return *itr;
    }

    static const value_t& get_data(const const_itr_t& itr)
    {
        return *itr;
    }

Notice that I've removed const indentifier for non-const version of get_data. Fixes should be applied for two template structures:

template<typename T>
struct sequential_container_base_static;
template<typename T>
struct sequential_container_base_dynamic;