anonymous enums

M

mosfet

Hi,

would it be possible to return an anonymous enum ?
I would like to write something like :

// .NET enum styles : corresponds to public enum class View
struct View
{
enum
{
List = LVS_LIST,
Details = LVS_REPORT,
SmallIcon = LVS_SMALLICON,
LargeIcon = LVS_ICON,
};
};


class CxListCtrl : public CWindowImpl<CxListCtrl, CListViewCtrl>
{
public:

BEGIN_MSG_MAP(CxListCtrl)
END_MSG_MAP()


void set_View(View view);
View get_View();


protected:
View m_propView;
};


CxListCtrl listctrl;

lisctr.set_View(View::Details);
View view = lisctr.get_View();
 
A

Alf P. Steinbach

* mosfet:
Hi,

would it be possible to return an anonymous enum ?
I would like to write something like :

// .NET enum styles : corresponds to public enum class View
struct View
{
enum
{
List = LVS_LIST,
Details = LVS_REPORT,
SmallIcon = LVS_SMALLICON,
LargeIcon = LVS_ICON,
};
};


class CxListCtrl : public CWindowImpl<CxListCtrl, CListViewCtrl>
{
public:

BEGIN_MSG_MAP(CxListCtrl)
END_MSG_MAP()


void set_View(View view);
View get_View();


protected:
View m_propView;
};


CxListCtrl listctrl;

lisctr.set_View(View::Details);
View view = lisctr.get_View();

What exactly is the problem?
 
V

Victor Bazarov

mosfet said:
Hi,

would it be possible to return an anonymous enum ?
I would like to write something like :

// .NET enum styles : corresponds to public enum class View
struct View
{
enum
{
List = LVS_LIST,
Details = LVS_REPORT,
SmallIcon = LVS_SMALLICON,
LargeIcon = LVS_ICON,
};
};


class CxListCtrl : public CWindowImpl<CxListCtrl, CListViewCtrl>
{
public:

BEGIN_MSG_MAP(CxListCtrl)
END_MSG_MAP()


void set_View(View view);
View get_View();


protected:
View m_propView;
};


CxListCtrl listctrl;

lisctr.set_View(View::Details);
View view = lisctr.get_View();

I believe you're confused. You're not *returning an anonymous enum*.
You're returning an instance of a named type ('View') that contains
an anonymous enum as a member.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,291
Messages
2,571,455
Members
48,132
Latest member
KatlynC08

Latest Threads

Top