<p>I have a <code>vector</code> that I want to insert into a <code>set</code>. This is one of three different calls (the other two are more complex, involving <code>boost::lambda::if_()</code>), but solving this simple case will help me solve the others.</p>

<pre><code>std::vector&lt;std::string&gt; s_vector;
std::set&lt;std::string&gt; s_set;
std::for_each(s_vector.begin(), s_vector.end(), s_set.insert(boost::lambda::_1));
</code></pre>

<p>Unfortunately, this fails with a conversion error message (trying to convert <code>boost::lambda::placeholder1_type</code> to <code>std::string</code>).</p>

<p>So... what's wrong with this?</p>

I think part of the problem is that
```
for_each()
```
is expecting a functor and you're passing it the result of a function call. So your code would call
```
vector<string>::insert()
```
first and then pass the result of that call to
```
for_each()
```
. I'm not sure of the exact syntax, but I think you want to use bind in combination with lambda here. e.g.
```
```
for_each(s_vector.begin(), s_vector.end(),
         boost::bind(set<string>::insert, s_set, boost::lambda::_1));
```
```