Adobe Systems Incorporated


Category: functors Component type: type


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


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

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


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 project1st's first argument type, and its result type.  
Arg2 project1st's second argument type.  

Model of


Type requirements


Public base classes

binary_function<Arg1, Arg2, Arg1>


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

New members

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


See also

functors, identity, project2nd, 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