Boost logo

Boost Users :

Subject: Re: [Boost-users] boost lambda wiht bind to stringstream::str
From: Conoscenza Silente (abruzzoforteegentile_at_[hidden])
Date: 2010-07-15 19:42:23


P.S. I used this code for my checkings

    std::string outString;
    bl::var_type< std::string >::type _outString( bl::var(outString) );
...
            _outString = bl::bind(

 static_cast<std::string(std::stringstream::*)()const>(&std::stringstream::str),
                boost::ref(_outFmt) )(),
            std::cout << _outString << '\n', // Here I have
always an empty string
           // so the previous call to bind doesn't really return
anything..do you know why?
...

On Fri, Jul 16, 2010 at 1:41 AM, Conoscenza Silente <
abruzzoforteegentile_at_[hidden]> wrote:

> Auch....I realized that vOut is empty..that's the reason for the error.
> By the way still this std::transform looks like it is is not able to store
> anything into vOut.
>
> I double checked and it seems that the call to bind doesn't return
> anything.
> Do you know why?
>
>
> On Fri, Jul 16, 2010 at 1:04 AM, Conoscenza Silente <
> abruzzoforteegentile_at_[hidden]> wrote:
>
>> Thanks Igor
>> I changed the code into this one and it builds BUT now I have SEGMANTATION
>> FAULT error.
>> Do you know what could be?
>>
>> bl::bind(
>>
>> static_cast<std::string(std::stringstream::*)()const>(&std::stringstream::str),
>> boost::ref(outFmt) )()
>>
>> My intention is to return the call to stringstream::str() into the second
>> vector used by std::transform, but I am
>> not sure if I am achieving this.
>>
>>
>>
>> On Fri, Jul 16, 2010 at 12:45 AM, Igor R <boost.lists_at_[hidden]> wrote:
>>
>>> > Below I am using std::transform algorithm but when I try to call
>>> > std::stringstream::str() function using lambda::bind I receive the
>>> following
>>> > error message:
>>> >
>>> > TestBoost15Jul.cpp:49: error: no matching function for call to
>>> > ‘bind(<unresolved overloaded function type>, const
>>> > boost::reference_wrapper<std::basic_stringstream<char,
>>> > std::char_traits<char>, std::allocator<char> > >)’
>>> <...>
>>> > bl::bind( &std::stringstream::str , boost::ref(outFmt) )()
>>> //
>>> > this call to bind has some problem
>>> > ) );
>>>
>>> str() member function is overloaded, so you have to type-cast it
>>> explicitly to one of the overloads.
>>> _______________________________________________
>>> Boost-users mailing list
>>> Boost-users_at_[hidden]
>>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>>
>>
>>
>



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