mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Added some compile time asserts.
This commit is contained in:
parent
19ccb387b5
commit
2e2b317668
@ -591,6 +591,7 @@ namespace dlib
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
COMPILE_TIME_ASSERT(is_signed_type<typename potts_model::value_type>::value);
|
||||||
min_cut mc;
|
min_cut mc;
|
||||||
dlib::impl::potts_flow_graph<potts_model> pfg(prob);
|
dlib::impl::potts_flow_graph<potts_model> pfg(prob);
|
||||||
mc(pfg, prob.number_of_nodes(), prob.number_of_nodes()+1);
|
mc(pfg, prob.number_of_nodes(), prob.number_of_nodes()+1);
|
||||||
@ -615,6 +616,7 @@ namespace dlib
|
|||||||
|
|
||||||
// The edges and node's have to use the same type to represent factor weights!
|
// The edges and node's have to use the same type to represent factor weights!
|
||||||
COMPILE_TIME_ASSERT((is_same_type<edge_type, type>::value == true));
|
COMPILE_TIME_ASSERT((is_same_type<edge_type, type>::value == true));
|
||||||
|
COMPILE_TIME_ASSERT(is_signed_type<edge_type>::value);
|
||||||
|
|
||||||
#ifdef ENABLE_ASSERTS
|
#ifdef ENABLE_ASSERTS
|
||||||
for (unsigned long i = 0; i < g.number_of_nodes(); ++i)
|
for (unsigned long i = 0; i < g.number_of_nodes(); ++i)
|
||||||
|
@ -149,6 +149,8 @@ namespace dlib
|
|||||||
orphans.clear();
|
orphans.clear();
|
||||||
|
|
||||||
typedef typename flow_graph::edge_type edge_type;
|
typedef typename flow_graph::edge_type edge_type;
|
||||||
|
COMPILE_TIME_ASSERT(is_signed_type<edge_type>::value);
|
||||||
|
|
||||||
typedef typename flow_graph::out_edge_iterator out_edge_iterator;
|
typedef typename flow_graph::out_edge_iterator out_edge_iterator;
|
||||||
typedef typename flow_graph::in_edge_iterator in_edge_iterator;
|
typedef typename flow_graph::in_edge_iterator in_edge_iterator;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user