本文整理汇总了C++中BOOST_CONCEPT_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ BOOST_CONCEPT_ASSERT函数的具体用法?C++ BOOST_CONCEPT_ASSERT怎么用?C++ BOOST_CONCEPT_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了BOOST_CONCEPT_ASSERT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: BOOST_CONCEPT_ASSERT
std::vector<typename Observator::observable_type> Metropolis<ConfigurationType, Step, RandomNumberGenerator>::do_metropolis_simulation(const TemperatureType& beta)
{
// Check the concept of the observator
BOOST_CONCEPT_ASSERT((Concepts::ObservatorConcept<Observator,ConfigurationType>));
// Check the concept of the observable
BOOST_CONCEPT_ASSERT((Concepts::ObservableConcept<typename Observator::observable_type>));
// Call the accumulator function using the VectorAccumulator
Details::Metropolis::VectorAccumulator<typename Observator::observable_type> measurements_accumulator;
do_metropolis_simulation<Observator>(beta, measurements_accumulator);
// Return the plain data
return measurements_accumulator.internal_vector;
}
开发者ID:SpeckFleck,项目名称:mocasinns,代码行数:14,代码来源:metropolis.cpp
示例2: add_edge_aggregator
bool add_edge_aggregator(const std::string& key,
EdgeMapType map_function,
FinalizerType finalize_function) {
BOOST_CONCEPT_ASSERT((graphlab::Serializable<ReductionType>));
BOOST_CONCEPT_ASSERT((graphlab::OpPlusEq<ReductionType>));
aggregator_type* aggregator = get_aggregator();
if(aggregator == NULL) {
logstream(LOG_FATAL) << "Aggregation not supported by this engine!"
<< std::endl;
return false; // does not return
}
return aggregator->template add_edge_aggregator<ReductionType>
(key, map_function, finalize_function);
} // end of add edge aggregator
开发者ID:Bhushan1002,项目名称:SFrame,代码行数:14,代码来源:iengine.hpp
示例3: evaluate
typename range_value_type<CVsRange>::type
evaluate( std::size_t degree,
const CVsRange& cvs,
const KnotsRange& knots,
typename range_value_type<KnotsRange>::type u)
{
BOOST_CONCEPT_ASSERT(( boost::RandomAccessRangeConcept<CVsRange>));
BOOST_CONCEPT_ASSERT(( boost::RandomAccessRangeConcept<KnotsRange>));
std::size_t span = find_span( degree, boost::size( cvs), knots, u);
boost::array<typename range_value_type<KnotsRange>::type, NURBS_MAX_BASIS_DEGREE> N;
basis_functions( degree, u, span, knots, N.begin());
return evaluate( degree, cvs, N, span, u);
}
开发者ID:elanifegnirf,项目名称:ramenlibs,代码行数:15,代码来源:evaluate.hpp
示例4: all_degree_centralities
inline void
all_degree_centralities(const Graph& g, CentralityMap cent, Measure measure)
{
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
typedef typename graph_traits<Graph>::vertex_iterator VertexIterator;
BOOST_CONCEPT_ASSERT(( WritablePropertyMapConcept<CentralityMap,Vertex> ));
typedef typename property_traits<CentralityMap>::value_type Centrality;
VertexIterator i, end;
for(boost::tie(i, end) = vertices(g); i != end; ++i) {
Centrality c = degree_centrality(g, *i, measure);
put(cent, *i, c);
}
}
开发者ID:AbhinavJain13,项目名称:turicreate,代码行数:15,代码来源:degree_centrality.hpp
示例5: check_nsphere
void check_nsphere(S& to_check, RT radius, CT center_x, CT center_y, CT center_z)
{
BOOST_CONCEPT_ASSERT( (bg::concept::ConstNsphere<S>) );
BOOST_CONCEPT_ASSERT( (bg::concept::Nsphere<S>) );
BOOST_CHECK_EQUAL(bg::get_radius<0>(to_check), radius);
BOOST_CHECK_EQUAL(bg::get<0>(to_check), center_x);
BOOST_CHECK_EQUAL(bg::get<1>(to_check), center_y);
if (bg::dimension<S>::value >= 3)
{
BOOST_CHECK_EQUAL(bg::get<2>(to_check), center_z);
}
}
开发者ID:manctl,项目名称:boost,代码行数:15,代码来源:circle.cpp
示例6: run_d_ary_heap_test
void run_d_ary_heap_test(void)
{
typedef boost::heap::d_ary_heap<int, boost::heap::arity<D>,
boost::heap::stable<stable>,
boost::heap::compare<std::less<int> >,
boost::heap::allocator<std::allocator<int> > > pri_queue;
BOOST_CONCEPT_ASSERT((boost::heap::PriorityQueue<pri_queue>));
run_concept_check<pri_queue>();
run_common_heap_tests<pri_queue>();
run_iterator_heap_tests<pri_queue>();
run_copyable_heap_tests<pri_queue>();
run_moveable_heap_tests<pri_queue>();
run_reserve_heap_tests<pri_queue>();
run_merge_tests<pri_queue>();
run_ordered_iterator_tests<pri_queue>();
if (stable) {
typedef boost::heap::d_ary_heap<q_tester, boost::heap::arity<D>,
boost::heap::stable<stable>
> stable_pri_queue;
run_stable_heap_tests<stable_pri_queue>();
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
cmpthings ord;
boost::heap::d_ary_heap<thing, boost::heap::arity<D>, boost::heap::compare<cmpthings>, boost::heap::stable<stable> > vpq(ord);
vpq.emplace(5, 6, 7);
#endif
}
开发者ID:MillenniumBlood,项目名称:Boost.1.54.0,代码行数:33,代码来源:d_ary_heap_test.cpp
示例7: point_angle_compare
point_angle_compare( const Point& origin, const NumberComparisonPolicy& cmp = NumberComparisonPolicy() )
: m_origin( origin )
, m_reference( 1., 0. )
, m_cmp(cmp)
{
BOOST_CONCEPT_ASSERT((Point2DConcept<Point>));
}
开发者ID:brandon-kohn,项目名称:geometrix,代码行数:7,代码来源:point_angle_compare.hpp
示例8: possible_edges
inline typename graph_traits<Graph>::degree_size_type
possible_edges(const Graph& g, std::size_t k, directed_tag)
{
BOOST_CONCEPT_ASSERT(( GraphConcept<Graph> ));
typedef typename graph_traits<Graph>::degree_size_type T;
return T(k) * (T(k) - 1);
}
开发者ID:00liujj,项目名称:dealii,代码行数:7,代码来源:clustering_coefficient.hpp
示例9: mean_clustering_coefficient
inline typename property_traits<ClusteringMap>::value_type
mean_clustering_coefficient(const Graph& g, ClusteringMap cm)
{
BOOST_CONCEPT_ASSERT(( VertexListGraphConcept<Graph> ));
typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
typedef typename graph_traits<Graph>::vertex_iterator VertexIterator;
BOOST_CONCEPT_ASSERT(( ReadablePropertyMapConcept<ClusteringMap,Vertex> ));
typedef typename property_traits<ClusteringMap>::value_type Coefficient;
Coefficient cc(0);
VertexIterator i, end;
for(boost::tie(i, end) = vertices(g); i != end; ++i) {
cc += get(cm, *i);
}
return cc / Coefficient(num_vertices(g));
}
开发者ID:00liujj,项目名称:dealii,代码行数:16,代码来源:clustering_coefficient.hpp
示例10: spectral_to_xyz
color3_t<typename range::value_type<ConstRandomAccessRange>::type, xyz_t>
spectral_to_xyz( const CieXYZCurves& cie_xyz_curves,
T min_wavelength, T max_wavelenght,
const ConstRandomAccessRange& values)
{
BOOST_CONCEPT_ASSERT(( CieXYZFit<CieXYZCurves>));
typedef typename boost::range_iterator<const ConstRandomAccessRange>::type iterator_type;
typedef typename range::value_type<ConstRandomAccessRange>::type real_type;
std::size_t num_samples = boost::size( values);
real_type w = min_wavelength;
real_type w_step = max_wavelenght - min_wavelength / static_cast<real_type>( num_samples);
color3_t<real_type, xyz_t> result( 0);
for( iterator_type it( boost::begin( values)), e( boost::end( values)); it != e; ++it)
{
iterator_type next( it + 1);
if( next != e)
{
real_type avg(( *it + *next) * real_type( 0.5));
result.x += cie_xyz_curves.X( w) * avg;
result.y += cie_xyz_curves.Y( w) * avg;
result.z += cie_xyz_curves.Z( w) * avg;
}
w += w_step;
}
return result;
}
开发者ID:elanifegnirf,项目名称:ramenlibs,代码行数:33,代码来源:spectral_to_xyz.hpp
示例11: run_d_ary_heap_mutable_test
void run_d_ary_heap_mutable_test(void)
{
typedef boost::heap::d_ary_heap<int, boost::heap::mutable_<true>,
boost::heap::arity<D>,
boost::heap::stable<stable>
> pri_queue;
BOOST_CONCEPT_ASSERT((boost::heap::MutablePriorityQueue<pri_queue>));
run_common_heap_tests<pri_queue>();
run_moveable_heap_tests<pri_queue>();
run_reserve_heap_tests<pri_queue>();
run_mutable_heap_tests<pri_queue>();
run_merge_tests<pri_queue>();
run_ordered_iterator_tests<pri_queue>();
if (stable) {
typedef boost::heap::d_ary_heap<q_tester, boost::heap::mutable_<true>,
boost::heap::arity<D>,
boost::heap::stable<stable>
> stable_pri_queue;
run_stable_heap_tests<stable_pri_queue>();
}
}
开发者ID:cpascal,项目名称:af-cpp,代码行数:26,代码来源:d_ary_heap_test.cpp
示例12: constraints
void constraints()
{
BOOST_CONCEPT_ASSERT(( CopyConstructibleConcept<Visitor> ));
vis.examine_vertex(u,g);
vis.finish_vertex(u,g);
vis.examine_edge(e,g);
}
开发者ID:0xDEC0DE8,项目名称:mcsema,代码行数:7,代码来源:core_numbers.hpp
示例13: apply
static void apply(ApplyMethod)
{
typedef typename parameter_type_of
<
ApplyMethod, 0
>::type ptype;
typedef typename parameter_type_of
<
ApplyMethod, 1
>::type sptype;
// 1) must define meta-function return_type
typedef typename strategy::distance::services::return_type<Strategy, ptype, sptype>::type rtype;
// 2) must define underlying point-distance-strategy
typedef typename strategy::distance::services::strategy_point_point<Strategy>::type stype;
BOOST_CONCEPT_ASSERT
(
(concept::PointDistanceStrategy<stype, Point, PointOfSegment>)
);
Strategy *str = 0;
ptype *p = 0;
sptype *sp1 = 0;
sptype *sp2 = 0;
rtype r = str->apply(*p, *sp1, *sp2);
boost::ignore_unused_variable_warning(str);
boost::ignore_unused_variable_warning(r);
}
开发者ID:7modelsan,项目名称:kbengine,代码行数:33,代码来源:distance_concept.hpp
示例14: depth_first_search
void
depth_first_search(const VertexListGraph& g, DFSVisitor vis, ColorMap color,
typename graph_traits<VertexListGraph>::vertex_descriptor start_vertex)
{
typedef typename graph_traits<VertexListGraph>::vertex_descriptor Vertex;
BOOST_CONCEPT_ASSERT(( DFSVisitorConcept<DFSVisitor, VertexListGraph> ));
typedef typename property_traits<ColorMap>::value_type ColorValue;
typedef color_traits<ColorValue> Color;
typename graph_traits<VertexListGraph>::vertex_iterator ui, ui_end;
for (boost::tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) {
Vertex u = implicit_cast<Vertex>(*ui);
put(color, u, Color::white()); vis.initialize_vertex(u, g);
}
if (start_vertex != implicit_cast<Vertex>(*vertices(g).first)){ vis.start_vertex(start_vertex, g);
detail::depth_first_visit_impl(g, start_vertex, vis, color,
detail::nontruth2());
}
for (boost::tie(ui, ui_end) = vertices(g); ui != ui_end; ++ui) {
Vertex u = implicit_cast<Vertex>(*ui);
ColorValue u_color = get(color, u);
if (u_color == Color::white()) { vis.start_vertex(u, g);
detail::depth_first_visit_impl(g, u, vis, color, detail::nontruth2());
}
}
}
开发者ID:Bia10,项目名称:clrn,代码行数:28,代码来源:depth_first_search.hpp
示例15: run_d_ary_heap_test
void run_d_ary_heap_test(void)
{
typedef boost::heap::d_ary_heap<int, boost::heap::arity<D>,
boost::heap::stable<stable>,
boost::heap::compare<std::less<int> >,
boost::heap::allocator<std::allocator<int> > > pri_queue;
BOOST_CONCEPT_ASSERT((boost::heap::PriorityQueue<pri_queue>));
run_concept_check<pri_queue>();
run_common_heap_tests<pri_queue>();
run_iterator_heap_tests<pri_queue>();
run_copyable_heap_tests<pri_queue>();
run_moveable_heap_tests<pri_queue>();
run_reserve_heap_tests<pri_queue>();
run_merge_tests<pri_queue>();
run_ordered_iterator_tests<pri_queue>();
if (stable) {
typedef boost::heap::d_ary_heap<q_tester, boost::heap::arity<D>,
boost::heap::stable<stable>
> stable_pri_queue;
run_stable_heap_tests<stable_pri_queue>();
}
}
开发者ID:cpascal,项目名称:af-cpp,代码行数:27,代码来源:d_ary_heap_test.cpp
示例16: BOOST_AUTO_TEST_CASE_TEMPLATE
BOOST_AUTO_TEST_CASE_TEMPLATE(Iterator, T, InMemoryStorages)
{
T ims;
BOOST_CONCEPT_ASSERT((boost::InputIterator<InMemoryStorage::const_iterator>));
for (int i = 0; i < 10; i++) {
std::ostringstream convert;
convert << i;
Name name("/" + convert.str());
shared_ptr<Data> data = makeData(name);
ims.insert(*data);
}
InMemoryStorage::const_iterator it = ims.begin();
InMemoryStorage::const_iterator tmp1 = it;
BOOST_REQUIRE(tmp1 == it);
InMemoryStorage::const_iterator tmp2 = tmp1++;
BOOST_REQUIRE(tmp2 != tmp1);
tmp2 = ++tmp1;
BOOST_REQUIRE(tmp2 == tmp1);
int i = 0;
for (;it != ims.end(); it++) {
std::ostringstream convert;
convert << i;
Name name("/" + convert.str());
BOOST_CHECK_EQUAL(it->getName(), name);
BOOST_CHECK_EQUAL((*it).getName(), name);
i++;
}
}
开发者ID:named-data-ndnSIM,项目名称:ndn-cxx,代码行数:32,代码来源:in-memory-storage-common.t.cpp
示例17: BOOST_GRAPH_ENABLE_IF_MODELS_PARM
inline void
write_graphviz
(std::ostream& out, const Graph& g,
VertexPropertiesWriter vpw,
EdgePropertiesWriter epw,
GraphPropertiesWriter gpw,
VertexID vertex_id
BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph,vertex_list_graph_tag))
{
BOOST_CONCEPT_ASSERT((EdgeListGraphConcept<Graph>));
typedef typename graph_traits<Graph>::directed_category cat_type;
typedef graphviz_io_traits<cat_type> Traits;
std::string name = "G";
out << Traits::name() << " " << name << " {" << std::endl;
gpw(out); //print graph properties
typename graph_traits<Graph>::vertex_iterator i, end;
for(tie(i,end) = vertices(g); i != end; ++i) {
out << get(vertex_id, *i);
vpw(out, *i); //print vertex attributes
out << ";" << std::endl;
}
typename graph_traits<Graph>::edge_iterator ei, edge_end;
for(tie(ei, edge_end) = edges(g); ei != edge_end; ++ei) {
out << get(vertex_id, source(*ei, g)) << Traits::delimiter() << get(vertex_id, target(*ei, g)) << " ";
epw(out, *ei); //print edge attributes
out << ";" << std::endl;
}
out << "}" << std::endl;
}
开发者ID:bacchante95,项目名称:fritzing,代码行数:33,代码来源:graphviz.hpp
示例18: test_all_2d
void test_all_2d()
{
P1 p;
P2 sp1, sp2;
bg::read_wkt("POINT(1 1)", p);
bg::read_wkt("POINT(0 0)", sp1);
bg::read_wkt("POINT(2 3)", sp2);
typedef typename bg::strategy::distance::projected_point
<
P1,
P2
> strategy_type;
BOOST_CONCEPT_ASSERT
(
(bg::concept::PointSegmentDistanceStrategy<strategy_type>)
);
strategy_type strategy;
typedef typename bg::strategy::distance::services::return_type<strategy_type>::type return_type;
return_type d = strategy.apply(p, sp1, sp2);
BOOST_CHECK_CLOSE(d, return_type(0.27735203958327), 0.001);
}
开发者ID:ArkanaLord,项目名称:libboost,代码行数:25,代码来源:projected_point.cpp
示例19: test_distance
void test_distance(double lon1, double lat1, double lon2, double lat2, double expected_km)
{
// Set radius type, but for integer coordinates we want to have floating point radius type
typedef typename bg::promote_floating_point
<
typename bg::coordinate_type<P1>::type
>::type rtype;
typedef bg::srs::spheroid<rtype> stype;
typedef bg::strategy::distance::thomas<stype> thomas_type;
BOOST_CONCEPT_ASSERT
(
(bg::concepts::PointDistanceStrategy<thomas_type, P1, P2>)
);
thomas_type thomas;
typedef typename bg::strategy::distance
::services::return_type<thomas_type, P1, P2>::type return_type;
P1 p1;
P2 p2;
bg::assign_values(p1, lon1, lat1);
bg::assign_values(p2, lon2, lat2);
BOOST_CHECK_CLOSE(thomas.apply(p1, p2), return_type(1000.0 * expected_km), 0.001);
BOOST_CHECK_CLOSE(bg::distance(p1, p2, thomas), return_type(1000.0 * expected_km), 0.001);
}
开发者ID:alexeykuzmin0,项目名称:ThePlatform,代码行数:31,代码来源:thomas.cpp
示例20: heap_merge
void heap_merge(Heap1 & lhs, Heap2 & rhs)
{
BOOST_CONCEPT_ASSERT((boost::heap::PriorityQueue<Heap1>));
BOOST_CONCEPT_ASSERT((boost::heap::PriorityQueue<Heap2>));
// if this assertion is triggered, the value_compare types are incompatible
BOOST_STATIC_ASSERT((boost::is_same<typename Heap1::value_compare, typename Heap2::value_compare>::value));
const bool same_heaps = boost::is_same<Heap1, Heap2>::value;
typedef typename boost::mpl::if_c<same_heaps,
detail::heap_merge_same<Heap1>,
detail::heap_merge_emulate<Heap1, Heap2>
>::type heap_merger;
heap_merger::merge(lhs, rhs);
}
开发者ID:13W,项目名称:icq-desktop,代码行数:17,代码来源:heap_merge.hpp
注:本文中的BOOST_CONCEPT_ASSERT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论