本文整理汇总了C++中boost::array::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ array::begin方法的具体用法?C++ array::begin怎么用?C++ array::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::array
的用法示例。
在下文中一共展示了array::begin方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle_receive
void handle_receive(const boost::system::error_code& e,
std::size_t bytes_transferred) {
std::cout << "received message: '" << std::string(recv_buffer_.begin(), recv_buffer_.begin() + bytes_transferred) << "'\n";
// TRYING TO CHECK FOR TRUNCATION, NOT WORKING
// std::cout << e << std::endl;
// if (!e || e == boost::asio::error::message_size) {
// std::cout << "wat?\n";
// }
// restart receive
start_receive();
}
示例2: create
//--------------------------------------------------------------------------
//! Construct with signed distance function values of the vertices
void create( const boost::array<double,numElementNodes>& signedDistances )
{
// Minimal value of signed distances
const double distMin = *(std::min_element( signedDistances.begin(),
signedDistances.end() ) );
// Maximal value of signed distances
const double distMax = *(std::max_element( signedDistances.begin(),
signedDistances.end() ) );
// Change of signs implies a cut cell
if ( (distMin * distMax) <= 0. ) {
isCut_ = true;
isInside_ = false;
isOutside_ = false;
// get the vertices of the shape
boost::array<VecDim,LinearLagrange::numFun> vertexCoordinates;
LinearLagrange::supportPoints( vertexCoordinates );
boost::array<unsigned,LinearLagrange::numFun> vertexIndices;
// fill nodes with the vertices of this shape
for ( unsigned v = 0; v < vertexCoordinates.size(); v++ ) {
nodes_.push_back( vertexCoordinates[v] );
vertexIndices[v] = v;
}
// create the internal structure of the cut cell
std::map<base::cut::Edge,unsigned> uniqueNodes;
base::cut::MarchingProxy<shape,geomDegree>::apply( signedDistances,
vertexIndices,
nodes_,
uniqueNodes,
surface_,
volumeIn_, volumeOut_,
false );
}
else {
isCut_ = false;
// decide location of cell which is not cut
if ( distMax < 0. ) { isInside_ = false; isOutside_ = true; }
else { isInside_ = true; isOutside_ = false; }
}
}
示例3: setup_covariance
void setup_covariance(boost::array<double, 9> &cov, double stdev) {
std::fill(cov.begin(), cov.end(), 0.0);
if (stdev == 0.0)
cov[0] = -1.0;
else {
cov[0+0] = cov[3+1] = cov[6+2] = std::pow(stdev, 2);
}
}
示例4: get_padded_image
/** @brief Get a view of the main data array, including padding */
Tracker::array_type_r Tracker::get_padded_image(const boost::array<size_t,3>& ordering)
{
boost::array<size_t,3> paddedExt;
for(size_t d=0;d<3;++d)
paddedExt[ordering[d]] = (d==2) ? 2*FFTmask.shape()[d] : centersMap.shape()[d];
bool ascending[] = {true,true,true};
return array_type_r(data, paddedExt, boost::general_storage_order<3>(ordering.begin(),ascending));
}
示例5: HandleReceive
void DiscoveryServer::HandleReceive(const boost::system::error_code& error) {
if (!error &&
std::string(m_recv_buffer.begin(), m_recv_buffer.end()) == DISCOVERY_QUESTION) {
m_socket.send_to(
boost::asio::buffer(DISCOVERY_ANSWER + boost::asio::ip::host_name()),
m_remote_endpoint);
}
Listen();
}
示例6: Stepper
BOOST_AUTO_TEST_CASE_TEMPLATE( copy_stepper_iterator , Stepper , dummy_steppers )
{
typedef times_iterator< Stepper , empty_system , state_type , time_iterator_type > iterator_type;
state_type x = {{ 1.0 }};
iterator_type iter1 = iterator_type( Stepper() , empty_system() , x , times.begin() , times.end() , 0.1 );
iterator_type iter2 = iter1;
BOOST_CHECK_EQUAL( &(*iter1) , &(*iter2) );
BOOST_CHECK_EQUAL( &(*iter1) , &x );
BOOST_CHECK( iter1.same( iter2 ) );
}
示例7:
BOOST_AUTO_TEST_CASE_TEMPLATE( stepper_range , Stepper , dummy_steppers )
{
std::cout << "range" << std::endl;
Stepper stepper;
empty_system system;
state_type x = {{ 1.0 }};
boost::for_each( make_times_range( stepper , boost::ref( system ) , x , times.begin() , times.end() , 0.1 ) ,
dummy_observer() );
BOOST_CHECK_CLOSE( x[0] , 1.75 , 1.0e-13 );
}
示例8:
~FiberControl(){
AUTO(it, g_stack_pool.begin());
for(;;){
if(it == g_stack_pool.end()){
stack.reset();
break;
}
if(!*it){
stack.swap(*it);
break;
}
++it;
}
}
示例9: FiberControl
explicit FiberControl(Initializer)
: state(FS_READY)
{
AUTO(it, g_stack_pool.begin());
for(;;){
if(it == g_stack_pool.end()){
stack.reset(new StackStorage);
break;
}
if(*it){
stack.swap(*it);
break;
}
++it;
}
}
示例10: thx
sAudioReceiver(boost::asio::io_service& io_service, sAudioBuffer* audiobuf, char* host, int port) : audiobuf(audiobuf), socket(io_service), ping_interval(boost::posix_time::seconds(1)) {
printf("Creating sAudioReceiver on %s:%d\n", host, port);
socket.open(boost::asio::ip::udp::v4());
receiver_endpoint = boost::asio::ip::udp::endpoint(boost::asio::ip::address::from_string(host), port);
std::string thx("ihazo");
std::copy(thx.begin(), thx.end(), send_arr.begin());
printf("Created sAudioReceiver\n");
send_request();
start_receive();
printf("Sent request\n");
ping_timer = new boost::asio::deadline_timer(socket.get_io_service(), ping_interval);
start_timer();
}