Added some compile time asserts.

This commit is contained in:
Davis King 2012-05-14 21:13:23 -04:00
parent 19ccb387b5
commit 2e2b317668
2 changed files with 4 additions and 0 deletions

View File

@ -591,6 +591,7 @@ namespace dlib
}
}
#endif
COMPILE_TIME_ASSERT(is_signed_type<typename potts_model::value_type>::value);
min_cut mc;
dlib::impl::potts_flow_graph<potts_model> pfg(prob);
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!
COMPILE_TIME_ASSERT((is_same_type<edge_type, type>::value == true));
COMPILE_TIME_ASSERT(is_signed_type<edge_type>::value);
#ifdef ENABLE_ASSERTS
for (unsigned long i = 0; i < g.number_of_nodes(); ++i)

View File

@ -149,6 +149,8 @@ namespace dlib
orphans.clear();
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::in_edge_iterator in_edge_iterator;