本文整理匯總了C++中BOOST_CONCEPT_ASSERT函數的典型用法代碼示例。如果您正苦於以下問題:C++ BOOST_CONCEPT_ASSERT函數的具體用法?C++ BOOST_CONCEPT_ASSERT怎麽用?C++ BOOST_CONCEPT_ASSERT使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了BOOST_CONCEPT_ASSERT函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
示例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
示例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);
}
示例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);
}
}
示例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);
}
}
示例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
}
示例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>));
}
示例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);
}
示例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));
}
示例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;
}
示例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>();
}
}
示例12: constraints
void constraints()
{
BOOST_CONCEPT_ASSERT(( CopyConstructibleConcept<Visitor> ));
vis.examine_vertex(u,g);
vis.finish_vertex(u,g);
vis.examine_edge(e,g);
}
示例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);
}
示例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());
}
}
}
示例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>();
}
}