Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2005-12-11 10:49:06


"Howard Hinnant" <hinnant_at_[hidden]> wrote

> 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
> > [...]

> If you put:
>
> #include <mslconfig>
> #undef _MSL_EXTENDED_BINDERS
>
> high up in the translation unit (configuration maybe?), then the
> typedef will compile.

Aha! Interesting... So they did "extend" their binders in some way, which
probaby causes the problem...

> 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.

I understand this. We just use this technique to pass the template around
as a type, and later extract it using partial template specialization:

template<template<class> class Tpl, class T>
class x<Tpl<T> >
{
    // use Tpl and ignore T
};

I believe "typedef binder1st<int> type;" should be OK (and is OK with the
rest of compilers, at least in the regression's release view) since it's not
supposed to cause binder1st instantiation...

If I am not mistaken, the same technique is used by MPL in its lambda.

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

We have this, but I generally want to have also standard-compliant emulation
working. Just in case one wants to write code in cw, which is supposed to
also work, say, in vc8.

> > 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.

I see...

Then is it possible to take a look inside, and see what is so specific about
binder "extension" that causes the problem with this particular templates?

(unless this kind of thing is also not allowed with their licence)

Regards,
Arkadiy


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