On Thursday 25 April 2002 12:40 pm, Lars Gullik Bjønnes wrote: > Angus Leeming <[EMAIL PROTECTED]> writes: > | What's the official take on putting functors in namespace anon and then > | passing them to an STL routine? > | > | Here, I get warnings like: > | cxx: Warning: /usr/include/cxx/algorithm.cc, line 110: #1115-D external > | routine > | uses unnamed type or namespace. > | InputIterator find_if (InputIterator first, InputIterator last, Predicate > | pred) > | --------------^ > | > | I'm quite happy to turn this warning off. Just curious about Best > | Practice. Whatever that is. > > I belive it should be ok. > > What's not ok is using local classes for this: > > class Foo { > class Functor {}; > > void do_stuff() { > find_if(..., Functor()); > } > };
I'm hazy about why not. Because it can go out of scope? See, hazy! Could you lift my fog? Angus