$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Johan Råde (rade_at_[hidden])
Date: 2006-07-29 05:51:32
Daryle Walker wrote:
> On 7/28/06 10:04 AM, "Johan Råde" <rade_at_[hidden]> wrote:
> 
>> Does Boost offer any facility for declaring basic_string literals in
>> templates, i.e. something like
>>
>>    basic_string<CharType> s = BOOST_STRING("foo");
> 
> No, it doesn't AFAIK.  Would this provide anything useful if it did exist?
> It wouldn't be a literal, since "basic_string" isn't a built-in type.  That
> means there is no compile-time savings; a string object is still created and
> it happens at run-time.  What advantage would it have over something like:
> 
>     std::string  s( "foo" );
> 
> If you really meant any "CharType" and not just "char", then a
> "BOOST_STRING" macro would have to reference a locale (probably the default
> global one) to perform a conversion.
> 
I agree that "basic_string literal" is incorrect terminology.
I should have asked, "How do I initialize an object of type 
basic_string<CharType> with a string literal?"
Does Boost provide any nifty way of doing it?
--Johan Råde