Boost logo

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
>Unsubscribe & other changes:
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
        static char * namestorage ( )
            static char namearray[] = { "yadda", "stuff", "etc" };
            return namearray;

        char * operator [] ( int index )
            return namestorage ( )[index];

    } names;


Boost list run by bdawes at, gregod at, cpdaniel at, john at