Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2003-03-01 06:34:54

"Dirk Gerrits" <dirk_at_[hidden]> wrote in message
> At what cost? The strings you generate are indeed very readable, but
> specializing spelling for every type that might be a template parameter
> someday seems like too much of a burden to me.
> Others might disagree though...

I think that is a problem too. Maybe a macro could make things easier:

#define DECLARE_SPELLABLE( a_type ) \
template<> class spelling<a_type> { public: static const std::string
result; }; \
const std::string spelling<my_enum>::result = #a_type

but this should be preferrable be put in headers, so why not make the static
data into a function instead?
Like this:

template< typename T >
class spelling
    const string& result() const
       static const string res = ..;
       return res;

And the macro could be changed accordingly.



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