Im a c# dev trying to get into c++, and Im writing some custom controls. I need the c++ equivalent of the following complex c# Dictionary
private static Dictionary<PinchscapeColor,
Dictionary<PinchscapeColorLevel, Brush>> AccentColorMap;
PinchscapeColor and PinchscapeColorLevel are simple c# enums
public enum PinchscapeColorLevel
{
Light,
Medium
Dark
}
public enum PinchscapeColor
{
PinchscapeCyan,
PinchscapeLime,
PinchscapeMagenta,
PinchscapeTangerine,
PinchscapePlum
}
and I calculate a particular color/color level combination like this (in c#)
var color = AccentColorMap[PinchscapeColor.PinchscapeCyan][PinchscapeColorLevel.Dark];
my attempts to do this in c++ have succeeded up to a point:
my enums:
public enum class PinchscapeColorLevel
{
Light,
Medium,
Dark
};
public enum class PinchscapeColor
{
PinchscapeCyan,
PinchscapeLime,
PinchscapeMagenta,
PinchscapeTangerine,
PinchscapePlum
};
ive defined a map in my header file like this
Platform::Collections::Map<PinchscapeBasicControls::PinchscapeColor,
Platform::Collections::Map<PinchscapeBasicControls::PinchscapeColorLevel,
Windows::UI::Xaml::Media::Brush^>^>^ colorMap;
but Im getting the following compiler error:
program files (x86)\microsoft visual studio 11.0\vc\include\collection.h(1118): error C3986: 'Invoke': signature of public member contains native type 'std::less<_Ty>' (that's the first line, it goes on forever)
Does anyone have any ideas what Im doing wrong ? Id have imagined that this was gonna be easy :(
EDIT
Please find below a minimal code example that is all the code you need to replicate the issue:
1) Class1.h
#pragma once
namespace WindowsRuntimeComponent1
{
public enum class ColorLevelEnum
{
Light,
Medium,
Dark
};
public enum class ColorEnum
{
Cyan,
Lime,
Magenta,
Tangerine,
Plum
};
public ref class Class1 sealed
{
private:
Windows::Foundation::Collections::IMap<WindowsRuntimeComponent1::
ColorEnum,Windows::Foundation::Collections::IMap<WindowsRuntimeComponent1::
ColorLevelEnum,Windows::UI::Xaml::Media::Brush^>^>^ colorMap;
public:
Class1();
};
}
Class1.cpp
#include "pch.h"
#include <collection.h>
#include "Class1.h"
using namespace WindowsRuntimeComponent1;
using namespace Windows::UI::Xaml::Media;
using namespace Platform::Collections;
using namespace Platform;
Class1::Class1()
{
if (colorMap == nullptr)
{
colorMap = ref new Map<ColorEnum,Map<ColorLevelEnum,Brush^>^>();
}
}
hope that helps you recreate the issue
Thanks to anyone who is taking the time to help me sort this out