本文整理汇总了C++中pod_vector::swap方法的典型用法代码示例。如果您正苦于以下问题:C++ pod_vector::swap方法的具体用法?C++ pod_vector::swap怎么用?C++ pod_vector::swap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pod_vector
的用法示例。
在下文中一共展示了pod_vector::swap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get
/*!
Moving an operation sequence from a recorder to a player
\param rec
the object that was used to record the operation sequence. After this
operation, the state of the recording is no longer defined. For example,
the \c pod_vector member variables in \c this have been swapped with
\c rec .
*/
void get(recorder<Base>& rec)
{ size_t i;
// Var
num_rec_var_ = rec.num_rec_var_;
// Op
rec_op_.swap(rec.rec_op_);
// VecInd
rec_vecad_ind_.swap(rec.rec_vecad_ind_);
// Arg
rec_op_arg_.swap(rec.rec_op_arg_);
// Par
rec_par_.swap(rec.rec_par_);
// Txt
rec_text_.swap(rec.rec_text_);
// set the number of VecAD vectors
num_rec_vecad_vec_ = 0;
for(i = 0; i < rec_vecad_ind_.size(); i += rec_vecad_ind_[i] + 1)
num_rec_vecad_vec_++;
// rec_vecad_ind_ contains size of each VecAD followed by
// the parameter indices used to iniialize it.
CPPAD_ASSERT_UNKNOWN( i == rec_vecad_ind_.size() );
}
示例2: get
/*!
Moving an operation sequence from a recorder to a player
\param rec
the object that was used to record the operation sequence. After this
operation, the state of the recording is no longer defined. For example,
the \c pod_vector member variables in \c this have been swapped with
\c rec .
*/
void get(recorder<Base>& rec)
{ size_t i;
// just set size_t values
num_var_rec_ = rec.num_var_rec_;
num_load_op_rec_ = rec.num_load_op_rec_;
// op_rec_
op_rec_.swap(rec.op_rec_);
// vec_ind_rec_
vecad_ind_rec_.swap(rec.vecad_ind_rec_);
// op_arg_rec_
op_arg_rec_.swap(rec.op_arg_rec_);
// par_rec_
par_rec_.swap(rec.par_rec_);
// text_rec_
text_rec_.swap(rec.text_rec_);
// set the number of VecAD vectors
num_vecad_vec_rec_ = 0;
for(i = 0; i < vecad_ind_rec_.size(); i += vecad_ind_rec_[i] + 1)
num_vecad_vec_rec_++;
// vecad_ind_rec_ contains size of each VecAD followed by
// the parameter indices used to iniialize it.
CPPAD_ASSERT_UNKNOWN( i == vecad_ind_rec_.size() );
}