stlab.adobe.com Adobe Systems Incorporated

project2nd

functors.gif
type.gif
Category: functors Component type: type

Description

Project2nd is a functors that takes two arguments and returns its second argument; the first argument is unused. It is essentially a generalization of identity to the case of a BinaryFunction.

Example

int main()
{
  Vector<char*> v1(10, (char*) 0);
  Vector<int> v2(10, 137);
  Vector<int> result(10);

  transform(v1.begin(), v1.end(), v2.begin(), result.begin(),
            project2nd<char*, int>());
  assert(equal(v2.begin(), v2.end(), result.begin()));
}           

Definition

Defined in the standard header functional, and in the nonstandard backward-compatibility header function.h. This function object is an SGI extension; it is not part of the C++ standard.

Template parameters

Parameter Description Default
Arg1 project2nd's first argument type.  
Arg2 project2nd's second argument type, and its result type.  

Model of

AdaptableBinaryFunction

Type requirements

None.

Public base classes

binary_function<Arg1, Arg2, Arg2>

Members

Member Where defined Description
first_argument_type AdaptableBinaryFunction The type of project2nd's first argument: Arg1
second_argument_type AdaptableBinaryFunction The type of project2nd's second argument: Arg2
result_type AdaptableBinaryFunction The type of the result: Arg2.
Arg1 operator()(const Arg1&, const Arg2& y) const AdaptableBinaryFunction Function call. The return value is y.

New members

All of project2nd's members are defined in the AdaptableBinaryFunction requirements. project2nd does not introduce any new members.

Notes

See also

functors, identity, project1st, select1st, select2nd

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google