Boost logo

Boost Users :

Subject: Re: [Boost-users] How to convert std::string into basic_string
From: manish4gupta (manish_at_[hidden])
Date: 2009-09-17 05:23:42


Thank you very much. Now it works as suggested.

Regards

manish4gupta wrote:
>
>
> Thanks it works.....
> But after loading into the map when i try to get the value how can i do
> the reverse.i.e converting char_string into string
>
> std::string s = "test"; // OK
> char_string cs(s.c_str(), alloc_inst); // OK and thanks
> string y = (char_string) cs; // pblm
>
> error message
> run.cpp:63: error: conversion from ‘char_string’ to non-scalar type
> ‘boost::interprocess_container::basic_string<char, std::char_traits<char>,
> std::allocator<char> >’ requested
>
>
>
> Christoph Gysin-3 wrote:
>>
>>> This is ok but i have to convert string into boost string. if i use the
>>> method as suggested.
>>>
>>> string s = "hello";
>>> char_string y = ts;
>>
>> You probably want this:
>>
>> char_string cs(s.c_str(), alloc_inst);
>>
>> Chris
>> --
>> echo mailto: NOSPAM !#$.'<*>'|sed 's. ..'|tr "<*> !#:2" org_at_fr33z3
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>>
>>
>
>

-- 
View this message in context: http://www.nabble.com/How-to-convert-std%3A%3Astring-into-basic_string-tp25446943p25487911.html
Sent from the Boost - Users mailing list archive at Nabble.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