本文整理汇总了C++中BOOST_AUTO函数的典型用法代码示例。如果您正苦于以下问题:C++ BOOST_AUTO函数的具体用法?C++ BOOST_AUTO怎么用?C++ BOOST_AUTO使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BOOST_AUTO函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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));
}
开发者ID:HongLi15,项目名称:amgcl,代码行数:34,代码来源:amgcl.cpp
示例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;
}
}
}
开发者ID:cpascal,项目名称:af-cpp,代码行数:26,代码来源:recursive_polygons_buffer.cpp
示例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);
}
}
}
开发者ID:QwZhang,项目名称:gale,代码行数:35,代码来源:select_rings.cpp
示例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));
}
}
开发者ID:Adikteev,项目名称:rtbkit-deps,代码行数:35,代码来源:pythagoras.cpp
示例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));
}
}
开发者ID:OggYiu,项目名称:rag-engine,代码行数:35,代码来源:pythagoras_point_box.cpp
示例6: odr_no_uns2
void odr_no_uns2()
{
odr_test_1 t1;
odr_test_2 t2;
BOOST_AUTO(v1, t1);
BOOST_AUTO(v2, t2);
}
开发者ID:0xDEC0DE8,项目名称:mcsema,代码行数:7,代码来源:odr_no_uns2.cpp
示例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;
}
开发者ID:korkov,项目名称:cxxdb,代码行数:26,代码来源:cxxdb_example.cpp
示例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.
}
}
开发者ID:sbfnk,项目名称:LibBi,代码行数:29,代码来源:MarginalSISHandler.hpp
示例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);
}
}
开发者ID:milthorpe,项目名称:LibBi,代码行数:8,代码来源:misc.hpp
示例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);
}
开发者ID:ttnghia,项目名称:amgcl,代码行数:14,代码来源:vexcl.hpp
示例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()
);
}
开发者ID:MKG,项目名称:quaff,代码行数:13,代码来源:rule_farm.hpp
示例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;
}
}
开发者ID:wenxq,项目名称:cpp,代码行数:14,代码来源:main.cpp
示例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;
}
}
开发者ID:wenxq,项目名称:cpp,代码行数:16,代码来源:main.cpp
示例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;
}
开发者ID:Swagataacharya,项目名称:TRIQS,代码行数:60,代码来源:array_as_value_long.cpp
示例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)
{
}
}
}
开发者ID:imace,项目名称:kkS,代码行数:32,代码来源:LServer.cpp
示例16: main
int main() {
F1 f(7);
TEST((x_ >>2*x_ +1)(10));
triqs::clef::function<double(double,double)> f2;
f2(x_,y_) = x_ + y_;
TEST(f2(2,3));
f2(x_,y_) = x_ + 2*y_;
TEST(f2(2,3));
boost::function<double(double,double)> ff2(f2);
TEST(ff2(2,3));
triqs::clef::function<double(double)> f1 ( f(x_) + 2*x_ ,x_);
TEST(f1(3));
triqs::clef::function<double(double,double)> g2;
g2(x_,y_) = x_ - y_ + f2(x_,2*y_);
TEST(g2(2,3));
boost::function<double(double,double)> ff8 = make_function( x_ + y_, x_, y_);
TEST(ff8(2,3));
boost::function<double(double)> f3;
f3 = x_>> f(x_) + 2*x_;
TEST(f3(3));
BOOST_AUTO (h , make_function( 2*x_ + y_ + 1, x_));
// is a lazy expression expression with placeholder y_, returning a function...
std::cout << tql::eval(h, y_=1) << std::endl;
TEST(tql::eval( h, y_=1) (10));
TEST(h);
}
开发者ID:Swagataacharya,项目名称:TRIQS,代码行数:35,代码来源:function.cpp
示例17: adjacent_vertices
std::pair<
typename graph<Matrix>::adjacency_iterator,
typename graph<Matrix>::adjacency_iterator
>
adjacent_vertices(ptrdiff_t v, const graph<Matrix> &G) {
BOOST_AUTO(Aptr, G.A.ptr_data());
BOOST_AUTO(Acol, G.A.col_data());
typename Matrix::ptr_type row_beg = Aptr[v];
typename Matrix::ptr_type row_end = Aptr[v + 1];
return std::make_pair(
Acol + row_beg,
Acol + row_end
);
}
开发者ID:ttnghia,项目名称:amgcl,代码行数:16,代码来源:multicolor_gauss_seidel.hpp
示例18: dim
void ObservationDirectionDataPointsFilter<T>::inPlaceFilter(DataPoints& cloud)
{
const int dim(cloud.features.rows() - 1);
const int featDim(cloud.features.cols());
if (dim != 2 && dim != 3)
{
throw InvalidField(
(boost::format("ObservationDirectionDataPointsFilter: Error, works only in 2 or 3 dimensions, cloud has %1% dimensions.") % dim).str()
);
}
Vector center(dim);
center[0] = centerX;
center[1] = centerY;
if (dim == 3)
center[2] = centerZ;
cloud.allocateDescriptor("observationDirections", dim);
BOOST_AUTO(observationDirections, cloud.getDescriptorViewByName("observationDirections"));
for (int i = 0; i < featDim; ++i)
{
// Check normal orientation
const Vector p(cloud.features.block(0, i, dim, 1));
observationDirections.col(i) = center - p;
}
}
开发者ID:ethz-asl,项目名称:libpointmatcher,代码行数:28,代码来源:ObservationDirection.cpp
示例19: BOOST_AUTO
//沿着连接搜索
bool Framework::walkCycle(RigidPtr rp,Joint* parent,JointVec& map)
{
if(rp)
{
for(JointVec::iterator i=rp->mJoints.begin();i!=rp->mJoints.end();++i)
{
if(*i!=parent)
{
BOOST_AUTO(it,find(map.begin(),map.end(),*i));
if( it!=map.end() )
{ //发现重复
return false;
}
RigidPtr g = (*i)->other(rp);
if( g )
{
map.push_back(*i);
if( !walkCycle(g,*i,map) )
return false; //发现
map.pop_back();
}
}
}
}
return true;
}
开发者ID:JohnCrash,项目名称:iRobot,代码行数:27,代码来源:Framework.cpp
示例20: serialization_roundtrip
bool serialization_roundtrip(Value const &value,
Format const &format)
{
typedef typename boost::remove_const<Value>::type mutable_value;
std::vector<char> generated;
{
BOOST_AUTO(sink, szn::make_container_sink(generated));
szn::serialize(sink, value, format);
}
BOOST_AUTO(source, szn::make_range_source(generated));
mutable_value readValue;
szn::deserialize(source, readValue, format);
return Equal()(value, readValue);
}
开发者ID:TyRoXx,项目名称:serialization,代码行数:17,代码来源:serialization.cpp
注:本文中的BOOST_AUTO函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论