From 2d24b82cdfb12064cf360ce21d93d41e7854515b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Tue, 8 Jul 2008 16:57:56 +0000 Subject: [PATCH] Convert link error to compile-time error when using swap_nodes() and unlink() with any_hooks [SVN r47238] --- .../detail/any_node_and_algorithms.hpp | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/include/boost/intrusive/detail/any_node_and_algorithms.hpp b/include/boost/intrusive/detail/any_node_and_algorithms.hpp index 9662138..6a3d955 100644 --- a/include/boost/intrusive/detail/any_node_and_algorithms.hpp +++ b/include/boost/intrusive/detail/any_node_and_algorithms.hpp @@ -18,6 +18,7 @@ #include #include #include +#include namespace boost { namespace intrusive { @@ -238,6 +239,10 @@ class any_node_traits template class any_algorithms { + template + static void function_not_available_for_any_hooks(typename detail::enable_if >::type) + {} + public: typedef any_node node; typedef typename boost::pointer_to_other @@ -269,28 +274,18 @@ class any_algorithms static bool unique(const_node_ptr node) { return 0 == node->node_ptr_1; } - -#if defined(__EDG__) && defined(__STD_STRICT_ANSI) - // For compilers checking the full source code at compile time, regardless - // of whether the code is instantiated or not, we turn the compile error - // below into a link error. - static void unlink(node_ptr); - static void swap_nodes(node_ptr l, node_ptr r); -#else static void unlink(node_ptr) { - //Auto-unlink hooks and unlink() call for safe hooks are not - //available for any hooks!!! - any_algorithms::unlink_not_available_for_any_hooks(); + //Auto-unlink hooks and unlink() are not available for any hooks + any_algorithms::template function_not_available_for_any_hooks(); } static void swap_nodes(node_ptr l, node_ptr r) { //Any nodes have no swap_nodes capability because they don't know - //what algorithm they must use from unlink them from the container - any_algorithms::swap_nodes_not_available_for_any_hooks(); + //what algorithm they must use to unlink the node from the container + any_algorithms::template function_not_available_for_any_hooks(); } -#endif }; } //namespace intrusive