I've been trying to make a generic class to represent a range of values but am having some difficulty trying to work out what I'm missing (the compiler comlplains about a missing copy constructor, but all the implementations I've tried have failed). So my questions:
- Is there a Range template somewhere I've missed to avoid me reinventing this wheel?
- What format does the copy constructor need to be in?
- Is there anything else I've missed?
Here's my code as it stands:
namespace MyNamespace {
    generic<typename T> public ref class Range
    {
    protected:
        T m_min;
        T m_max;
    public:
        Range(T min, T max)
        {
            m_min = min;
            m_max = max;
        }
        property T Min {
            T get() { return m_min; }
            void set(T min) { m_min = min; }
        }
        property T Max {
            T get() { return m_max; }
            void set(T max) { m_max = max; }
        }
    };
    public ref class MyClass
    {
    protected:
        Range<int> m_myRange;
    public:
        property Range<int> MyRange 
        {
            Range<int> get() { return m_myRange; }
            void set( Range<int> myRange ) { m_myRange = myRange; }
        }
    }
}
The compiler complains about copy constructors in the Range class:
1>c:\projects\collections\Range.h(71) : error C2440: 'return' : cannot convert from 'MyNamespace::Range<T>' to 'ZephIRControlsLib::Range<T>'
1>        with
1>        [
1>            T=int
1>        ]
1>        Cannot copy construct class 'MyNamespace::Range<T>' due to ambiguous copy constructors or no available copy constructor
1>        with
1>        [
1>            T=int
1>        ]
1>c:\projects\collections\Range.h(72) : error C2582: 'operator =' function is unavailable in 'MyNamespace::Range<T>'
1>        with
1>        [
1>            T=int
1>        ]
1>.\Range.cpp(8) : error C2512: 'MyNamespace::Range<T>' : no appropriate default constructor available
1>        with
1>        [
1>            T=int
1>        ]