locked
Strange error when using VectorView<value struct> - possibly bug

    Question

  • Hi,

    I was trying to create a VectorView of one of my value structs when I got a strange compiler error. Here is the struct:

    value struct GradientStop
    	{
    		GradientStop(FLOAT p, const Color& c) :color(c), position(p) {}
    		FLOAT position;
    		Color color; //"Color" is another value struct in the project
    		static bool operator==(const GradientStop& a, const GradientStop& b){
    			return a.position == b.position && a.color == b.color;
    		}
    		bool operator==(const GradientStop& b){
    			return position == b.position && color == b.color;
    		}
    	};

    Here are two typedefs:

    typedef Windows::Foundation::Collections::IVectorView<GradientStop> GradientStopList;
    typedef Platform::Collections::VectorView<GradientStop> GradientStopListInstance;

    And some example usage:

    Brushes::GradientStopList^ stops = ref new Brushes::GradientStopListInstance();

    So the problem is that if I put this line (or some code like this) in my code, I get a strange error on "vccorlib.h line 1474" which is a built-in header file.

    The message is the following: error C2664: 'GradientStop::GradientStop(const GradientStop &)' : cannot convert parameter 1 from 'Platform::Box<T> ^' to 'const GradientStop &'

    And I also get two C4400 warnings as well on "collection.h" (built-in)

    warning C4400: 'const GradientStop *' : const/volatile qualifiers on this type are not supported
    warning C4400: 'const GradientStop &' : const/volatile qualifiers on this type are not supported

    I know they are not supported, but then why is collection.h using them?

    Please help me. Thanks

    Sunday, April 8, 2012 12:07 AM

Answers

All replies