From: Dean M. C. B. <dmb...@fr...> - 2008-04-15 12:11:24
|
> -----Original Message----- > From: cpp...@li... > [mailto:cpp...@li...] On > Behalf Of Glyn Matthews > Sent: Tuesday, April 15, 2008 8:06 PM > To: C++ Networking Library Developers Mailing List > Subject: Re: [cpp-netlib-devel] Review of http::message > > > Would it be possible to do something like the following: > namespace http { > namespace tags { > struct message_tag {}; > struct message_tag_w {}; > } > } > > namespace http { > namespace traits { > template < > typename Tag > > > struct delimiters; > > > template <> > struct delimiters<tags::message_tag> { > static char const *crlf() { > static const char *const crlf = "\x0D\x0A"; > return crlf; > } > }; > > > template <> > struct delimiters<tags::message_tag_w> { > static wchar_t const *crlf() { > static const wchar_t *const crlf = L"\x0D\x0A"; > return crlf; > } > }; > } > } > I like it. Thanks Glyn. :) It looks like stuff that the compiler will inline anyway because it has full type information with everything being static and all. However, it will change the way these are accessed -- instead of just doing values, we need to make function calls... Perhaps it may work. Mike, would that be too much of a trouble? I as much as possible would like to avoid anonymous namespaces because of the ODR. -- Dean Michael Berris Software Engineer, Friendster, Inc. <dmb...@fr...> +639287291459 |