Boost logo

Boost :

From: Olaf van der Spek (olafvdspek_at_[hidden])
Date: 2006-03-14 16:13:43


On 3/14/06, Pavol Droba <droba_at_[hidden]> wrote:
> Hi,
>
> I'm not sure. The code snippet you sent seems fine, so maybe the problem
> is elsewhere. I would check includes and namespaces.

I've now got:
#include <boost/algorithm/string.hpp>
#include <string>
#include <vector>

std::string f()
{
        return "";
}

int main()
{
        std::vector<std::string> v;
        boost::split(v, f(), boost::is_any_of(","));
        return 0;
}

split_test.cpp: In function 'int main()':
split_test.cpp:13: error: invalid initialization of non-const
reference of type 'std::string&' from a temporary of type
'std::string'
/usr/include/boost/algorithm/string/split.hpp:143: error: in passing
argument 2 of 'SequenceSequenceT&
boost::algorithm::split(SequenceSequenceT&, RangeT&, PredicateT,
boost::algorithm::token_compress_mode_type) [with SequenceSequenceT =
std::vector<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, std::allocator<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > > >, RangeT =
std::string, PredicateT = boost::algorithm::detail::is_any_ofF<char>]'


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk