Re: [Boost-users] [mpl]... is there an mpl::string

L$$m$Ll$l$l$ ------Original Message------ From: Eric Niebler Sender: boost-users-bounces@lists.boost.org To: boost-users@lists.boost.org ReplyTo: boost-users@lists.boost.org Sent: Apr 7, 2009 10:21 AM Subject: Re: [Boost-users] [mpl]... is there an mpl::string Noah Roberts wrote:
Eric Niebler wrote:
Andy Stevenson wrote:
I recall some discussion of there being an mpl::string template..... Can't see it in the mpl library. Is it elsewhere?
It has been added to trunk as of revision 52208:
https://svn.boost.org/trac/boost/changeset/52208
No doubt the regression tests will reveal portability problems. Once they have been worked out, we can move this to release.
Why is this better than a metafunction c_str< Sequence >?
typedef mpl::vector_c<char, 'h', 'e', 'l', 'l', 'o'> str;
template < char const* sz > struct x {};
x< c_str<str>::value > test;
Is there some reason that's not possible or is prone to problems avoided by mpl::string?
That is certainly a valid design. It's somewhat subjective, but IMO multi-character literals give a nicer compile-time string interface. Consider: // With mpl::vector_c mpl::vector_c<char, 'h','e','l','l','o',' ','w','o','r','l','d'> // With mpl::string mpl::string<'hell','o wo','rld'> Neither will win a beauty contest, but my preference is strongly for the latter. -- Eric Niebler BoostPro Computing http://www.boostpro.com _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users Sent from my Verizon Wireless BlackBerry
participants (1)
-
raindog@macrohmasheen.com