Boost logo

Boost Users :

From: Sean Farrow (sean.farrow_at_[hidden])
Date: 2008-07-07 05:51:30


Hi:
Thanks that worked.
Sean.

-----Original Message-----
From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Daniel Krügler
Sent: 07 July 2008 10:46
To: boost-users_at_[hidden]
Subject: Re: [Boost-users] Converting an std::vector to std::wstring

Sean Farrow wrote:
> How does this assign overload work?
> Sound like wht I need.

Like the c'tor call, but using assign instead ;-):

void from_vector(std::wstring& dst, const std::vector<wchar_t>& src) {
    dst.assign(src.begin(), src.end());
}

This call is semantically equivalent to:

dst.assign(wstring(src.begin(), src.end()));

The c'tor template accepts any InputIterator with value type convertible to the value_type of the corresponding basic_string.

[N.B.: If InputIterator is actually an integral type the standard requires that instead of a sequence constructor the constructor is invoked which creates astring of given size with given character value]

Greetings from Bremen,

Daniel Krügler

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
 

__________ Information from ESET NOD32 Antivirus, version of virus signature database 3245 (20080707) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 
 

__________ Information from ESET NOD32 Antivirus, version of virus signature database 3245 (20080707) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net