473,396 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

anonymous enums

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();
Jul 23 '07 #1
2 8325
On Jul 23, 2:19 pm, mosfet <john....@anonymous.orgwrote:
Hi,

would it be possible to return an anonymous enum ?
Did you try? What happend?

Greets,
Bas

Jul 23 '07 #2
mosfet wrote:
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
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jul 23 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: SpaceCowboy | last post by:
I recently got into a discussion with a co-worker about using enums across a dll interface. He wanted to use chars instead, argueing that depending on compiler settings the size of an enum could...
2
by: Faisal | last post by:
Can anyone tell me if it is possible to enumerate through all the Enums within a class . I have a class with many Enums and would like to accees the Enums through an array/collection etc. I can't...
27
by: Mark A. Gibbs | last post by:
i have been toying with the idea of making my enums smarter - ie, more in line with the rest of the language. i haven't tested it yet, but what i came up with is a template like this: template...
2
by: SpotNet | last post by:
Hello CSharpies, Can Enums in C# be UInt32 Types, and not just Int32 Types. I have a lot of constant declarations that are UInt32 that I want to put in Enums to ease the use of Intellisence. I...
4
by: Martin Pritchard | last post by:
Hi, I'm working on a project that historically contains around 40 enums. In the database various fields refer to the int values of these enums, but of course ref integrity is not enofrced and...
2
by: Simon Elliott | last post by:
I have some legacy C++ code which requires some enums to be 1 or 2 bytes in size. I'd ideally like to be able to specify that a few carefully selected enums are a particular size. By default,...
11
by: Marc Gravell | last post by:
This one stumped me while refactoring some code to use generics... Suppose I declare an enum MyEnum {...} Is there a good reason why MyEnum doesn't implement IEquatable<MyEnum> ? Of course,...
6
by: Gaijinco | last post by:
I have always felt that there are a lot of topics that you learned the facts but you only grasp the matter sometime down the road. For me, two of those topics are inner classes and anonymous...
16
by: andreyvul | last post by:
If I try compiling this in gcc, it says: "error: request for member `baz' in something not a structure or union". Any workarounds or tips on how to make a structure such that it behaves like an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.