Boost logo

Boost Users :

Subject: [Boost-users] The Placeholders _1 and _2
From: Missing Rainbow (d0253082_at_[hidden])
Date: 2008-10-08 16:12:05


Hi All,

I am going through Chapter 3 of the MPL book ("A Deeper Look at
Metafunctions") and have some questions on the placeholders _1 and _2.
  They are first introduced in the section 3.1.5 as follows:

typename mpl::transform<D1, D2, mpl::minus<_1, _2> >::type

I understand from the context that _1 represents D1 and _2 represents
D2. From this I understood that _1 will represent the first template
argument and _2 will represent the 2nd template argument. This made
sense in this context. But later I came across the following in
section 3.3:

template <class X>
struct two_pointers
   : twice<boost::add_pointer<_1>, X>
{};

In this context, it looks like _1 represents X, which is the 2nd
template argument. So what exactly _1 and _2 represents? The book
doesn't seem to define them. While I haven't completely read the book
yet, if it is defined at some other place, it would have been helpful
to provide a cross-reference when they are first introduced in chapter
3.

Can anybody provide a reference that explains what is a placeholder
and what _1 and _2 mean? And what is the maximum number of
placeholders?

Thank you.

Rgds,
anna

--
Two Party Fraud: Staged Presidential Debates
http://missingrainbow.blogspot.com/2008/10/two-party-fraud-staged-presidential.html

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