本文整理汇总了C++中pod_vector::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ pod_vector::push_back方法的具体用法?C++ pod_vector::push_back怎么用?C++ pod_vector::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pod_vector
的用法示例。
在下文中一共展示了pod_vector::push_back方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: get_rev
void subgraph_info::get_rev(
const play::const_random_iterator<Addr>& random_itr ,
const pod_vector<size_t>& dep_taddr ,
addr_t i_dep ,
pod_vector<addr_t>& subgraph )
{ // check sizes
CPPAD_ASSERT_UNKNOWN( map_user_op_.size() == n_op_ );
// process_range_
CPPAD_ASSERT_UNKNOWN( process_range_[i_dep] == false );
process_range_[i_dep] = true;
// special value; see init_rev_in_subgraph
addr_t depend_yes = addr_t( n_dep_ );
// assumption on i_dep
CPPAD_ASSERT_UNKNOWN( i_dep < depend_yes );
// start with an empty subgraph for this dependent variable
subgraph.resize(0);
// tape index corresponding to this dependent variable
size_t i_var = dep_taddr[i_dep];
// operator corresponding to this dependent variable
size_t i_op = random_itr.var2op(i_var);
i_op = size_t( map_user_op_[i_op] );
// if this variable depends on the selected indepent variables
// process its subgraph
CPPAD_ASSERT_UNKNOWN( in_subgraph_[i_op] != i_dep )
if( in_subgraph_[i_op] <= depend_yes )
{ subgraph.push_back( addr_t(i_op) );
in_subgraph_[i_op] = i_dep;
}
// space used to return set of arguments that are variables
pod_vector<size_t> argument_variable;
// temporary space used by get_argument_variable
pod_vector<bool> work;
// scan all the operators in this subgraph
size_t sub_index = 0;
while(sub_index < subgraph.size() )
{ // this operator connected to this dependent and selected independent
i_op = size_t( subgraph[sub_index] );
CPPAD_ASSERT_UNKNOWN( in_subgraph_[i_op] == i_dep );
//
// There must be a result for this operator
# ifndef NDEBUG
OpCode op = random_itr.get_op(i_op);
CPPAD_ASSERT_UNKNOWN(op == AFunOp || NumRes(op) > 0 );
# endif
//
// which variables are connected to this operator
get_argument_variable(random_itr, i_op, argument_variable, work);
for(size_t j = 0; j < argument_variable.size(); ++j)
{ // add the corresponding operators to the subgraph
size_t j_var = argument_variable[j];
size_t j_op = random_itr.var2op(j_var);
j_op = size_t( map_user_op_[j_op] );
bool add = in_subgraph_[j_op] <= depend_yes;
add &= in_subgraph_[j_op] != i_dep;
if( random_itr.get_op(j_op) == InvOp )
{ CPPAD_ASSERT_UNKNOWN( j_op == j_var );
add &= select_domain_[j_var - 1];
}
if( add )
{ subgraph.push_back( addr_t(j_op) );
in_subgraph_[j_op] = i_dep;
}
}
// we are done scaning this subgraph operator
++sub_index;
}
}