Boost logo

Boost Users :

Subject: Re: [Boost-users] MPL: Arguments to transform metafunction
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2008-10-15 14:12:30


AMDG

Missing Rainbow wrote:
> Here mpl::transform takes 2 sequences and a binary operation and it
> results in a sequence.
>
> <snip>
>
> Here mpl::transform takes 1 sequence and a unary operation and it
> results in a sequence. How does mpl::transform supports such
> different arguments?
>

mpl::transform is "overloaded" to handle either 1 or 2 sequences.

The actual definition is something like:

template<class Sequence1, class Sequence2OrUnaryOperation, class
BinaryOperation = na>
struct transform : transform2<Sequence1, Sequence2OrUnaryOperation,
BinaryOperation> {};

template<class Sequence1, class UnaryOperation>
struct transform<Sequence, UnaryOperation> : transform1<Sequence1,
UnaryOperation> {};

In Christ,
Steven Watanabe


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net