Returning a const reference to a C-array?

Viewed 4644

Here is my example classes :

template<typename T> class MyClassVector
{
    public:
        inline const std::vector<T>& data() const
        {
            return _data;
        }

    protected:
        std::vector<T> _data;
};

template<typename T, unsigned int SIZE> class MyClassArray
{
    public:
        inline const /* SOMETHING */ data() const
        {
            return _data; // OR SOMETHING ELSE
        }

    protected:
        T _data[SIZE];
};

My question is : what is the equivalent of the MyClassVector data() function for the MyClassArray class to return a constant reference to the underlying _data container ?

Thank you very much !

5 Answers
Related