c++stlsgi

why I can't use the function adaptor compose2?


I use GCC 4.1.2 on linux, and the STL must be SGI STL. After I wrote:

#include <functional>
 std::find_if(PirateFlush, PirateFlush + size,
                compose2(std::logical_and<bool>(), bind2nd(std::greater<UInt32>(), time),
                    bind2nd(std::less<UInt32>(), now)));

the compiler said:

error: ‘compose2’ was not declared in this scope

what's the matter?


Solution

  • compose2 is not standard and is neither in the global nor std namespaces.

    gcc ships some non-standard SGI extensions in the __gnu_cxx namespace.

    Use __gnu_cxx::compose2, or boost has many of these predefined.

    -nick