$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-02-01 14:55:32
AMDG
Jean-Pierre Bergamin wrote:
> Trying to compile the same code with gcc 3.4.5 gives the error:
> test.cpp:18: error: no matching function for call to `bind(<unknown type>,
> boost::arg<1> (&)(), const char[2])'
>
> Does anyone has an idea how to let bind know the "type" of the predicate
> "contains"?
>
typedef bool (*contains_type)(const string&, const string&);
string_container::const_iterator s = find_if(numbers.begin(),
numbers.end(),
bind((contains_type)&contains<string, string>, _1, "w"));
Or better, use a function object:
struct contains {
typedef bool result_type;
bool operator()(const string& arg1, const string& arg2) {
return(boost::algorithm::contains(arg1, arg2));
}
};
In Christ,
Steven Watanabe