From a731b3caf413b9d2837ae1d61b46f65591a09dd5 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 11 Aug 2017 20:23:46 +0200 Subject: [PATCH] metaprogramming: get rid of the remaining boost::enable_if usages ...low hanging fruit --- src/lib/hash-standard.hpp | 3 +-- src/lib/iter-explorer.hpp | 8 ++++---- src/lib/meta/util.hpp | 5 +++-- src/lib/opaque-holder.hpp | 13 +++++++------ src/lib/polymorphic-value.hpp | 12 ++++-------- src/lib/test/depend-4test.hpp | 5 ++--- tests/library/format-cout-test.cpp | 2 +- 7 files changed, 22 insertions(+), 26 deletions(-) diff --git a/src/lib/hash-standard.hpp b/src/lib/hash-standard.hpp index 7da4aee64..8122ca775 100644 --- a/src/lib/hash-standard.hpp +++ b/src/lib/hash-standard.hpp @@ -73,7 +73,6 @@ #include #include -#include namespace lib { @@ -124,7 +123,7 @@ namespace std { * Specialisation: Bridge from std::hash to boost::hash */ template - struct _HashImplementationSelector >::type > + struct _HashImplementationSelector::value >> : public __hash_base { size_t diff --git a/src/lib/iter-explorer.hpp b/src/lib/iter-explorer.hpp index 408ea78f2..800cec49d 100644 --- a/src/lib/iter-explorer.hpp +++ b/src/lib/iter-explorer.hpp @@ -260,8 +260,8 @@ namespace lib { namespace iter_explorer { ///< predefined "exploration strategies", policies and configurations using util::unConst; - using boost::enable_if; - using boost::disable_if; + using lib::meta::enable_if; + using lib::meta::disable_if; using std::function; using meta::_Fun; @@ -450,7 +450,7 @@ namespace lib { class ChainedIters; template - class ChainedIters>::type + class ChainedIters> > : public IterStateWrapper @@ -471,7 +471,7 @@ namespace lib { * of the given iterator is itself an iterator */ template - class ChainedIters>::type + class ChainedIters> > : public IterStateWrapper, SEQ> diff --git a/src/lib/meta/util.hpp b/src/lib/meta/util.hpp index 3bb19f511..3dd474a51 100644 --- a/src/lib/meta/util.hpp +++ b/src/lib/meta/util.hpp @@ -161,8 +161,9 @@ namespace meta { /** Trait template for detecting a typelist type. - * For example, this allows to write specialisations with the help of - * boost::enable_if + * For example, this allows to write specialisations + * with the help of lib::meta::enable_if + * (or the equivalent std::enable_if) */ template class is_Typelist diff --git a/src/lib/opaque-holder.hpp b/src/lib/opaque-holder.hpp index 58f23cb31..6e1fe9689 100644 --- a/src/lib/opaque-holder.hpp +++ b/src/lib/opaque-holder.hpp @@ -69,6 +69,7 @@ #include "lib/error.hpp" #include "lib/access-casted.hpp" +#include "lib/meta/util.hpp" #include "lib/util.hpp" #include @@ -86,21 +87,21 @@ namespace lib { namespace { // implementation helpers... - using boost::enable_if; - using boost::disable_if; + using lib::meta::enable_if; + using lib::meta::disable_if; using std::is_constructible; template - typename enable_if< is_constructible, - bool >::type + enable_if< is_constructible, + bool > validitySelfCheck (X const& boolConvertible) { return bool(boolConvertible); } template - typename disable_if< is_constructible, - bool >::type + disable_if< is_constructible, + bool > validitySelfCheck (X const&) { return true; // just pass if this type doesn't provide a validity check... diff --git a/src/lib/polymorphic-value.hpp b/src/lib/polymorphic-value.hpp index c4e683e5c..441bd72f7 100644 --- a/src/lib/polymorphic-value.hpp +++ b/src/lib/polymorphic-value.hpp @@ -156,17 +156,13 @@ #include "lib/meta/duck-detector.hpp" #include "lib/util.hpp" -#include -#include - namespace lib { - namespace polyvalue { // implementation details... namespace error = lumiera::error; - using boost::enable_if; + using lib::meta::enable_if; using lib::meta::Yes_t; using lib::meta::No_t; @@ -270,7 +266,7 @@ namespace lib { * to the container will raise an exception */ template - struct AssignmentPolicy >::type> + struct AssignmentPolicy >> { template static void @@ -316,7 +312,7 @@ namespace lib { * simple \c static_cast without runtime overhead. */ template - struct Trait >::type> + struct Trait >> { typedef TY CopyAPI; enum{ ADMIN_OVERHEAD = 1 * sizeof(void*) }; @@ -396,7 +392,7 @@ namespace lib { template PolymorphicValue (IMP*) { - BOOST_STATIC_ASSERT (siz >= sizeof(IMP)); + static_assert (siz >= sizeof(IMP), "insufficient inline buffer size"); new(&buf_) IMP(); } diff --git a/src/lib/test/depend-4test.hpp b/src/lib/test/depend-4test.hpp index cdab44ff6..628725c49 100644 --- a/src/lib/test/depend-4test.hpp +++ b/src/lib/test/depend-4test.hpp @@ -36,7 +36,6 @@ #include "lib/meta/duck-detector.hpp" #include -#include #include @@ -45,7 +44,7 @@ namespace test{ namespace { ///< details: inject a mock automatically in place of a singleton - using boost::enable_if; + using lib::meta::enable_if; using lib::meta::Yes_t; using lib::meta::No_t; @@ -79,7 +78,7 @@ namespace test{ template - struct ServiceInterface>::type> + struct ServiceInterface >> { typedef typename MOCK::ServiceInterface Type; }; diff --git a/tests/library/format-cout-test.cpp b/tests/library/format-cout-test.cpp index fb17e1648..19c2df69e 100644 --- a/tests/library/format-cout-test.cpp +++ b/tests/library/format-cout-test.cpp @@ -116,7 +116,7 @@ namespace test { * I decided to allow `` in this category, which allows us * at least to show a type name as fallback * - distill an essential version of `enable_if`, which can be inlined. - * This allows us to get rid of `boost::enable_if` finally. + * This allowed us to get rid of `boost::enable_if` finally. * - build a sensible `operator string()` for our `lib::P` based on this * - and _finally_, to come up with a templated version of the `ostream` * inserter `operator<<`, which does not cause too much havoc when