|
Boost : |
From: Jason Hise (chaos_at_[hidden])
Date: 2005-12-08 20:34:07
Frank Laub wrote:
>>Just change 'namespace' to 'struct' and I think you should be set :)
>>
>>
>
>Hmm, I tried this but I got compiler errors. The problem is I won't be able
>to set the names collection in a header, that's because you can't set an
>array of non-integral type inside the declaration of a struct. You have to
>provide storage for it in a .cpp. Is there perhaps something I'm missing
>here?
>_______________________________________________
>Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
Would it work to provide storage for it in a static function inside the
struct? If you need to keep the same syntax you could create a proxy
class to access it, something like this (untested):
struct myenum
{
static struct
{
private:
static char * namestorage ( )
{
static char namearray[] = { "yadda", "stuff", "etc" };
return namearray;
}
public:
char * operator [] ( int index )
{
return namestorage ( )[index];
}
} names;
};
-Jason
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk