Boost logo

Boost :

From: Jordan DeLong (jordan.delong_at_[hidden])
Date: 2006-12-15 13:15:55

The other day I wrote a line that looked something like:

  std::remove_if(foo.begin(), foo.end(),
    some_condition ? !boost::is_any_of("blah")
                   : boost::is_any_of("blah")),

This compiled fine, but behaved unexpectedly at runtime. It seems that
the compiler decides to instantiate the remove_if template with the
predicate type as the negator class, which has an implicit constructor.
So even when some_condition is false, it still ended up negating the

The class involved is algorithm::detail::pred_notF<>. Is there any reason
for the constructor to be implicit? (Some of the other constructors in
classification.hpp are also implicit.)


Jordan DeLong

Boost list run by bdawes at, gregod at, cpdaniel at, john at