On Mon, Sep 15, 2003 at 02:22:57PM +0000, Angus Leeming wrote:

+struct Class { \
+       /** The default argument is nasty, \
+        *  but allows us to use Class in STL containers. \
+        */ \   
+       Class(Enum val = static_cast<Enum>(-1)) : val_(val) {} \
+       operator Enum() const{ return val_; } \
+private: \
+       Enum val_; \
+}

If you don't like the default argument, why don't you use two
constructors?

+       Class() : val_(-1) {} \
+       Class(Enum val) : val_(val) {} \

I am not too fond of this macro business and I'd rather resort to a
separate LColor_enum.h header that contains this some 'ColorEnum' enum
only and include this header when it is needed. This would serve almost
the same purpose, wouldn't it?

Andre'

Attachment: enumlcolor.diff.gz
Description: GNU Zip compressed data

Reply via email to