Boost logo

Boost Users :

From: Scott McMurray (me22.ca+boost_at_[hidden])
Date: 2008-04-07 17:50:33


On Mon, Apr 7, 2008 at 2:06 PM, Olaf Peter <ope-devel_at_[hidden]> wrote:
> for_each( values.begin(), values.end(), std::cout << _1 << '\n');
>
> error: 'for_each' was not declared in this scope
>

You never included <algorithm>, and it's std::for_each anyways.

> using std::list compiles and works. Did I miss something?
>

That's a fluke. One of the headers (perhaps <list>) happens to
include <algorithm>, and using std::list means that std::for_each gets
found by ADL. Neither are good style, and the first is non-conforming
if <algorithm> came indirectly from a standard header.


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