Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2005-12-11 10:04:16


On Dec 11, 2005, at 7:29 AM, Arkadiy Vertleyb wrote:

> Hi all,
>
> I am having a typeof test problem in cw, which I tracked down to
> inability
> to compile the following:
>
> typedef std::binder1st< int > type2; // error
>
> The error message is:
> Error : illegal use of template argument dependent type
> 'T::first_argument_type'
>
> Looks like something causes the compiler to instantiate the
> template...
>
> Interestingly, the other similar constructs seem to do fine:
>
> typedef std::binary_negate< int > type1; // OK
>
> Thanks in advance for any advice.

If you put:

#include <mslconfig>
#undef _MSL_EXTENDED_BINDERS

high up in the translation unit (configuration maybe?), then the
typedef will compile.

Are you sure you want to do things like this? The type int does not
meet the requirements for these template parameters. For example in
std::binder1st<Operation>, the requirements include:

1. Operation has a nested type named first_argument_type.
2. Operation has a nested type named second_argument_type.
3. Operation has a nested type named result_type.

If your intent is simply to get a typeof working on cw, it might be
easier to map to its existing __typeof__ facility.

#include <functional>

#define typeof __typeof__

int main()
{
        typeof(std::bind1st(std::greater<int>(), 5)) f = std::bind1st
(std::greater<int>(), 5);
        bool b = f(3);
}

> Also I would greatly appreciate, if
> somebody could send me the sources of CW's binder1st and binary_negate
> (functional.hpp)

Unfortunately these are not open sourced.

-Howard


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk