...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
Front Page / Algorithms / Transformation Algorithms / copy |
template< typename Sequence , typename In = unspecified > struct copy { typedef unspecified type; };
Returns a copy of the original sequence.
[Note: This wording applies to a no-inserter version(s) of the algorithm. See the Expression semantics subsection for a precise specification of the algorithm's details in all cases — end note]
#include <boost/mpl/copy.hpp>
Parameter | Requirement | Description |
---|---|---|
Sequence | Forward Sequence | A sequence to copy. |
In | Inserter | An inserter. |
The semantics of an expression are defined only where they differ from, or are not defined in Reversible Algorithm.
For any Forward Sequence s, and an Inserter in:
typedef copy<s,in>::type r;
Return type: | A type. |
---|---|
Semantics: | Equivalent to typedef fold< s,in::state,in::operation >::type r; |
Linear. Exactly size<s>::value applications of in::operation.
typedef vector_c<int,0,1,2,3,4,5,6,7,8,9> numbers; typedef copy< range_c<int,10,20> , back_inserter< numbers > >::type result; BOOST_MPL_ASSERT_RELATION( size<result>::value, ==, 20 ); BOOST_MPL_ASSERT(( equal< result,range_c<int,0,20> > ));