本文整理汇总了C++中BOOST_AUTO函数的典型用法代码示例。如果您正苦于以下问题:C++ BOOST_AUTO函数的具体用法?C++ BOOST_AUTO怎么用?C++ BOOST_AUTO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BOOST_AUTO函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: amgcl_precond_create_f
//---------------------------------------------------------------------------
amgclHandle STDCALL amgcl_precond_create_f(
int n,
const int *ptr,
const int *col,
const double *val,
amgclHandle prm
)
{
BOOST_AUTO(
ptr_c,
boost::make_transform_iterator(ptr, std::bind2nd(std::minus<int>(), 1))
);
BOOST_AUTO(
col_c,
boost::make_transform_iterator(col, std::bind2nd(std::minus<int>(), 1))
);
BOOST_AUTO(
A,
boost::make_tuple(
n,
boost::make_iterator_range(ptr_c, ptr_c + n + 1),
boost::make_iterator_range(col_c, col_c + ptr[n]),
boost::make_iterator_range(val, val + ptr[n])
)
);
if (prm)
return static_cast<amgclHandle>(new AMG(A, *static_cast<Params*>(prm)));
else
return static_cast<amgclHandle>(new AMG(A));
}
示例2: verify
bool verify(std::string const& caseid, MultiPolygon const& mp, MultiPolygon const& buffer, Settings const& settings)
{
bool result = true;
// Area of buffer must be larger than of original polygon
BOOST_AUTO(area_mp, bg::area(mp));
BOOST_AUTO(area_buf, bg::area(buffer));
if (area_buf < area_mp)
{
result = false;
}
if (result)
{
typedef boost::range_value<MultiPolygon const>::type polygon_type;
BOOST_FOREACH(polygon_type const& polygon, mp)
{
typename bg::point_type<polygon_type>::type point;
bg::point_on_border(point, polygon);
if (! bg::within(point, buffer))
{
result = false;
}
}
}
示例3: test_geometry
void test_geometry(std::string const& wkt1, std::string const& wkt2,
RingIdVector const& expected_ids,
WithinVector const& expected_withins)
{
typedef bg::detail::overlay::ring_properties<typename bg::point_type<Geometry1>::type> properties;
Geometry1 geometry1;
Geometry2 geometry2;
bg::read_wkt(wkt1, geometry1);
bg::read_wkt(wkt2, geometry2);
typedef std::map<bg::ring_identifier, properties> map_type;
map_type selected;
std::map<bg::ring_identifier, int> empty;
bg::detail::overlay::select_rings<OverlayType>(geometry1, geometry2, empty, selected);
BOOST_CHECK_EQUAL(selected.size(), expected_ids.size());
BOOST_CHECK_EQUAL(selected.size(), expected_withins.size());
if (selected.size() <= expected_ids.size())
{
BOOST_AUTO(eit, expected_ids.begin());
BOOST_AUTO(wit, expected_withins.begin());
for(typename map_type::const_iterator it = selected.begin(); it != selected.end(); ++it, ++eit, ++wit)
{
bg::ring_identifier const ring_id = it->first;
BOOST_CHECK_EQUAL(ring_id.source_index, eit->source_index);
BOOST_CHECK_EQUAL(ring_id.multi_index, eit->multi_index);
BOOST_CHECK_EQUAL(ring_id.ring_index, eit->ring_index);
BOOST_CHECK_EQUAL(it->second.within_code, *wit);
}
}
}
示例4: test_integer
void test_integer(bool check_types)
{
typedef bg::model::point<CoordinateType, 2, bg::cs::cartesian> point_type;
point_type p1, p2;
bg::assign_values(p1, 12345678, 23456789);
bg::assign_values(p2, 98765432, 87654321);
typedef bg::strategy::distance::pythagoras<> pythagoras_type;
pythagoras_type pythagoras;
BOOST_AUTO(distance, pythagoras.apply(p1, p2));
BOOST_CHECK_CLOSE(distance, 107655455.02347542, 0.001);
typedef typename bg::strategy::distance::services::comparable_type
<
pythagoras_type
>::type comparable_type;
comparable_type comparable;
BOOST_AUTO(cdistance, comparable.apply(p1, p2));
BOOST_CHECK_EQUAL(cdistance, 11589696996311540);
typedef BOOST_TYPEOF(cdistance) cdistance_type;
typedef BOOST_TYPEOF(distance) distance_type;
distance_type distance2 = sqrt(distance_type(cdistance));
BOOST_CHECK_CLOSE(distance, distance2, 0.001);
if (check_types)
{
BOOST_CHECK((boost::is_same<distance_type, double>::type::value));
// comparable_distance results in now double too, obviously because
// comp.distance point-segment can be fraction, even for integer input
BOOST_CHECK((boost::is_same<cdistance_type, double>::type::value));
}
}
示例5: test_integer
inline void test_integer(bool check_types)
{
typedef bg::model::point<CoordinateType, 2, bg::cs::cartesian> point_type;
typedef bg::model::box<point_type> box_type;
point_type p;
box_type b;
bg::assign_values(b, 0, 0, 12345678, 23456789);
bg::assign_values(p, 98765432, 87654321);
typedef bg::strategy::distance::pythagoras_point_box<> pythagoras_pb_type;
pythagoras_pb_type pythagoras_pb;
BOOST_AUTO(distance, pythagoras_pb.apply(p, b));
BOOST_CHECK_CLOSE(distance, 107655455.02347542, 0.001);
typedef typename bg::strategy::distance::services::comparable_type
<
pythagoras_pb_type
>::type comparable_type;
comparable_type comparable;
BOOST_AUTO(cdistance, comparable.apply(p, b));
BOOST_CHECK_EQUAL(cdistance, 11589696996311540);
typedef BOOST_TYPEOF(cdistance) cdistance_type;
typedef BOOST_TYPEOF(distance) distance_type;
distance_type distance2 = sqrt(distance_type(cdistance));
BOOST_CHECK_CLOSE(distance, distance2, 0.001);
if (check_types)
{
BOOST_CHECK((boost::is_same<distance_type, double>::type::value));
BOOST_CHECK((boost::is_same<cdistance_type, boost::long_long_type>::type::value));
}
}
示例6: odr_no_uns2
void odr_no_uns2()
{
odr_test_1 t1;
odr_test_2 t2;
BOOST_AUTO(v1, t1);
BOOST_AUTO(v2, t2);
}
示例7: main
int main()
{
my_db db;
db.insert(my_db::data_t(1, "alexander", "[email protected]", 26));
db.insert(my_db::data_t(2, "alexander", "[email protected]", 30));
BOOST_AUTO(range, db.select<name>("alexander"));
for(
BOOST_AUTO(iter, range.first);
iter != range.second;
++iter)
{
// print some fileds
LOG(
" name: " << my_db::get_field<name>(iter) <<
" email: " << my_db::get_field<email>(iter) <<
" | " <<
// print whole line
my_db::get(iter)
);
}
return 0;
}
示例8: Z
void bi::MarginalSISHandler<B,A,S>::handleAdapterSamples(
boost::mpi::communicator child, boost::mpi::status status) {
typedef typename temp_host_matrix<real>::type matrix_type;
static const int N = B::NP;
/* add samples */
boost::optional<int> n = status.template count<real>();
if (n) {
matrix_type Z(N + T, *n / (N + T));
child.recv(status.source(), status.tag(), Z.buf(), *n);
for (int j = 0; j < Z.size2(); ++j) {
adapter.add(subrange(column(Z,j), 0, N), subrange(column(Z,j), N, T));
}
}
/* send new proposal if necessary */
if (adapter.stop(t)) {
adapter.adapt(t);
BOOST_AUTO(q, adapter.get(t));
BOOST_AUTO(iter, node.children.begin());
for (; iter != node.children.end(); ++iter) {
node.requests.push_front(iter->isend(0, MPI_TAG_ADAPTER_PROPOSAL, q));
}
///@todo Serialize q into archive just once, then send to all. This may
///be how broadcast is already implemented in Boost.MPI.
}
}
示例9: BOOST_AUTO
inline void bi::exp_rows(M2 X, const V2& is) {
BOOST_AUTO(iter, is.begin());
BOOST_AUTO(end, is.end());
for (; iter != end; ++iter) {
BOOST_AUTO(row1, row(X, *iter));
exp_elements(row1, row1);
}
}
示例10: copy_matrix
// Copy matrix from builtin backend.
static boost::shared_ptr<matrix>
copy_matrix(boost::shared_ptr< typename builtin<real>::matrix > A, const params &prm)
{
precondition(!prm.context().empty(), "Empty VexCL context!");
const typename builtin<real>::matrix &a = *A;
BOOST_AUTO(Aptr, a.ptr_data());
BOOST_AUTO(Acol, a.col_data());
BOOST_AUTO(Aval, a.val_data());
return boost::make_shared<matrix>(prm.context(), rows(*A), cols(*A), Aptr, Acol, Aval);
}
示例11: operator
typename result<convert_farm(LHS, RHS, State, BackEnd)>::type
operator()(LHS const& lhs, RHS const& rhs, State& s, BackEnd const& be) const
{
convert<tag::process_network_> callee;
// Pre-compute environment to not copy it twice
BOOST_AUTO(lhe, callee(lhs,s,be) );
BOOST_AUTO(rhe, callee(rhs,lhe,be));
return make_environment ( join_network(lhe.network(),rhe.network())
, rhe.next_pid()
);
}
示例12: output
void output(const FileList& flist)
{
for (BOOST_AUTO(iter, flist.begin()); iter != flist.end(); ++iter)
{
BOOST_AUTO(&fmeta, iter->second);
std::vector<char> buffer;
std::cout << "name : " << GetFileName(fmeta.mName, buffer) << "\n, "
<< "meta : {" << fmeta.mMeta << "}, \n"
<< "offset: " << fmeta.mOffset << ", \n"
<< "fsize : " << fmeta.mFileSize << ", \n"
<< "wbsize: " << fmeta.mWriteBSize << "\n"
<< std::endl;
}
}
示例13: pop_all
void pop_all(DecodeFilePtr decoder)
{
int i = 0;
const FileList& flist = decoder->filelist();
for (BOOST_AUTO(iter, flist.begin()); iter != flist.end(); ++iter)
{
BOOST_AUTO(&fmeta, iter->second);
std::vector<char> buffer;
Slice fileid = fmeta.mName;
Slice filename = GetFileName(fileid, buffer);
std::cout << "decode: \"" << filename << "\":\n" << std::endl;
Slice outfile = fileid.substr(fileid.rfind(PATH_SEP) + 1);
decoder->pop(fileid, outfile);
std::cout << "---------------------------" << std::endl;
}
}
示例14: main
int main() {
//double x=1,y=2;
triqs::arrays::array<double,1> A(3); A(0)=1; A(1)=2; A(2)=3;
triqs::arrays::array_view<double,1> V(A);
//double a = 2;
BOOST_AUTO( exp , x_ + A);
std::cerr<< " -------------"<<std::endl;
TEST( tqa::make_array( tql::eval( 2.0*x_ , x_ =A) ));
TEST( tqa::make_array( tql::eval(2.0*x_ , x_ =3*A) ));
TEST( tqa::make_array( tql::eval (A + 2*x_ , x_ =A) ));
TEST( ( tql::eval (A + 2*x_ , x_ =A) ));
TEST( A(i_));
TEST( tql::eval( A(i_), i_=1));
triqs::arrays::array<double,2> B(2,2);
B(1,1) = 10;
TEST( tql::eval( B(i_,j_) , i_ = 1, j_ = 1));
B(i_,j_) = 10*i_ + j_;
std::cout <<B<<std::endl;
B(j_,i_) = 10*i_ + j_;
B(j_,i_) = 10*i_ + j_ +1;
B(j_,i_) = 10*i_ + 2*j_;
B(j_,i_) = 10*i_ - j_;
B(j_,i_) = i_ + j_;
B(j_,i_) = 1+2+ 10*i_ + j_;
B(j_,i_) = 10*i_ + j_;
B(j_,i_) = 10*i_ + j_ +1;
B(j_,i_) = 10*i_ + 2*j_;
B(j_,i_) = 10*i_ - j_;
B(j_,i_) = i_ + j_;
B(j_,i_) = 1+2+ 10*i_ + j_;
B(j_,i_) = 10*i_ + j_/1.0;
B(j_,i_) = 10*i_ + j_/3.8 +1;
B(j_,i_) = 10*i_ + 2*j_/8.1;
B(j_,i_) = 10*i_ - j_/9.0;
B(j_,i_) = i_ + j_/8.1;
B(j_,i_) = 1+2+ 10*i_ + j_/7.2;
B(j_,i_) = 1+2+ 10*i_ + j_/2.0;
B(j_,i_) = 11*i_ + j_;
B(j_,i_) = 12*i_ + j_;
B(j_,i_) = 13*i_ + j_;
B(j_,i_) = 14*i_ + j_;
B(j_,i_) = 15*i_ + j_;
B(j_,i_) = 20*i_ + j_;
B(j_,i_) = 30*i_ + j_;
B(j_,i_) = 40*i_ + j_;
B(j_,i_) = 50*i_ + j_;
std::cout <<B<<std::endl;
}
示例15: while
void LServer::tick( )
{
base::TimeInfo info;
while(!stop_)
{
if ( 1 )
{
ScopedLock lock(lock_);
BOOST_AUTO(it, connections_.begin());
for ( ;it != connections_.end(); ++it)
{
CmdPtr msg = it->second->recvCmd( );
for( ; msg; msg = it->second->recvCmd())
{
it->second->sendCmd(msg.get());
}
}
}
base::thisThreadSleep(1);
info.update();
if(info.diffDay() || info.diffHour())
{
regLog(info.diffHour(), info.diffDay());
}
if(((info.sysRunTime()/1000)%5) == 0)
{
}
}
}