Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext
copy
Description

Copy a sequence src to a sequence dest. It is also used to convert sequence into other.

Synopsis
template <typename Seq1, typename Seq2>
typename result_of::copy<Seq1, Seq2>::type copy(Seq1 const& src, Seq2& dest);

Table 1.36. Parameters

Parameter

Requirement

Description

src

A model of Forward Sequence, all elements contained in the src sequence should be convertible into the element contained in the dest sequence.

Operation's argument

dest

A model of Forward Sequence, e2 = e1 is valid expression for each pair of elements e1 of src and e2 of dest.

Operation's argument


Expression Semantics
copy(src, dest);

Return type: void

Semantics: e2 = e1 for each element e1 in src and e2 in dest.

Complexity

Linear, exactly result_of::size<Sequence>::value.

Header
#include <boost/fusion/algorithm/auxiliary/copy.hpp>
#include <boost/fusion/include/copy.hpp>
Example
vector<int,int> vec(1,2);
list<int,int> ls;
copy(vec, ls);
assert(ls == make_list(1,2));

PrevUpHomeNext