__________ Information from ESET NOD32 Antivirus, version of virus
signature database 3244 (20080705) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
_______________________________________________
Boost-users mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
I suspect 5. None of the above.
The quickest and most efficent way to switch between two containers
which contain the same type is:
new_container container(old_container.begin(), old_container.end() )
so in this case:
wstring my_string(v.begin(), e.end());
new_container container(old_container.begin(), old_container.end() )
so in this case:
wstring my_string(v.begin(), e.end());
signature database 3245 (20080707) __________
The message was checked by ESET NOD32 Antivirus.
__________ Information from ESET NOD32 Antivirus, version of virus
signature database 3245 (20080707) __________
What about the sequence assignment capabilities of basic_string
itself, like this:
std::wstring from_vector(const std::vector<wchar_t>& src) {
return std::wstring(src.begin(), src.end());
}
?
For already existing std::wstring objects you could use
it's assign overload that accepts an input iterator pair.
HTH & greetings from Bremen,
Daniel Krügler
-----Original Message-----
From: boost-use...@lists.boost.org [mailto:boost-use...@lists.boost.org] On Behalf Of Daniel Krügler
Sent: 07 July 2008 09:55
To: boost...@lists.boost.org
Subject: Re: [Boost-users] Converting an std::vector to std::wstring
?
Daniel Krügler
__________ Information from ESET NOD32 Antivirus, version of virus signature database 3245 (20080707) __________
The message was checked by ESET NOD32 Antivirus.
__________ Information from ESET NOD32 Antivirus, version of virus signature database 3245 (20080707) __________
The message was checked by ESET NOD32 Antivirus.
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,
-----Original Message-----
From: boost-use...@lists.boost.org [mailto:boost-use...@lists.boost.org] On Behalf Of Daniel Krügler
Sent: 07 July 2008 10:46
To: boost...@lists.boost.org
Subject: Re: [Boost-users] Converting an std::vector to std::wstring
dst.assign(wstring(src.begin(), src.end()));
Greetings from Bremen,
Daniel Krügler
__________ Information from ESET NOD32 Antivirus, version of virus signature database 3245 (20080707) __________
The message was checked by ESET NOD32 Antivirus.
__________ Information from ESET NOD32 Antivirus, version of virus signature database 3245 (20080707) __________
The message was checked by ESET NOD32 Antivirus.