Merge pull request #531 from Becheler/refactor/drop-tti-dependency

refactor: remove dependency on boost.tti using detector idiom
This commit is contained in:
Arnaud Becheler
2026-07-20 13:24:40 +02:00
committed by GitHub
3 changed files with 18 additions and 16 deletions
-1
View File
@@ -46,7 +46,6 @@ target_link_libraries(boost_graph
Boost::smart_ptr
Boost::spirit
Boost::throw_exception
Boost::tti
Boost::tuple
Boost::type_traits
Boost::unordered
-1
View File
@@ -35,7 +35,6 @@ constant boost_dependencies :
/boost/smart_ptr//boost_smart_ptr
/boost/spirit//boost_spirit
/boost/throw_exception//boost_throw_exception
/boost/tti//boost_tti
/boost/tuple//boost_tuple
/boost/type_traits//boost_type_traits
/boost/unordered//boost_unordered
+18 -14
View File
@@ -24,7 +24,8 @@
#include <boost/optional.hpp>
#include <boost/parameter.hpp>
#include <boost/concept/assert.hpp>
#include <boost/tti/has_member_function.hpp>
#include <boost/type_traits/make_void.hpp>
#include <type_traits>
#include <vector>
#include <utility>
@@ -68,7 +69,19 @@ namespace detail
}
};
BOOST_TTI_HAS_MEMBER_FUNCTION(finish_edge)
// has_finish_edge<Vis, E, G>::value is true when vis.finish_edge(e, g) is
// a valid call for e of type E and g of type const G&.
template < typename Vis, typename E, typename G, typename = void >
struct has_finish_edge : std::false_type
{
};
template < typename Vis, typename E, typename G >
struct has_finish_edge< Vis, E, G,
boost::void_t< decltype(std::declval< Vis& >().finish_edge(
std::declval< E& >(), std::declval< const G& >())) > >
: std::true_type
{
};
template < bool IsCallable > struct do_call_finish_edge
{
@@ -89,18 +102,9 @@ namespace detail
template < typename E, typename G, typename Vis >
void call_finish_edge(Vis& vis, E e, const G& g)
{ // Only call if method exists
#if ((defined(__GNUC__) && (__GNUC__ > 4) \
|| ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 9))) \
|| defined(__clang__) \
|| (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1200)))
do_call_finish_edge< has_member_function_finish_edge< Vis, void,
boost::mpl::vector< E, const G& > >::value >::call_finish_edge(vis,
e, g);
#else
do_call_finish_edge< has_member_function_finish_edge< Vis,
void >::value >::call_finish_edge(vis, e, g);
#endif
{ // Only call if the visitor has a callable finish_edge(e, g)
do_call_finish_edge< has_finish_edge< Vis, E, G >::value >::
call_finish_edge(vis, e, g);
}
// Define BOOST_RECURSIVE_DFS to use older, recursive version.