metaprogramming: get rid of the remaining boost::enable_if usages
...low hanging fruit
This commit is contained in:
parent
8c1a43a6b3
commit
a731b3caf4
7 changed files with 22 additions and 26 deletions
|
|
@ -73,7 +73,6 @@
|
|||
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
|
||||
|
||||
namespace lib {
|
||||
|
|
@ -124,7 +123,7 @@ namespace std {
|
|||
* Specialisation: Bridge from std::hash to boost::hash
|
||||
*/
|
||||
template<typename TY>
|
||||
struct _HashImplementationSelector<TY, typename boost::enable_if< lib::meta::provides_BoostHashFunction<TY> >::type >
|
||||
struct _HashImplementationSelector<TY, std::enable_if_t< lib::meta::provides_BoostHashFunction<TY>::value >>
|
||||
: public __hash_base<size_t, TY>
|
||||
{
|
||||
size_t
|
||||
|
|
|
|||
|
|
@ -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 ITI>
|
||||
class ChainedIters<ITI, typename enable_if< _is_iterator_of_iterators<ITI>>::type
|
||||
class ChainedIters<ITI, enable_if< _is_iterator_of_iterators<ITI>>
|
||||
>
|
||||
: public IterStateWrapper<typename ITI::value_type::value_type
|
||||
,ChainedIteratorImpl<ITI, typename ITI::value_type>
|
||||
|
|
@ -471,7 +471,7 @@ namespace lib {
|
|||
* of the given iterator is itself an iterator
|
||||
*/
|
||||
template<class SEQ>
|
||||
class ChainedIters<SEQ, typename disable_if< _is_iterator_of_iterators<SEQ>>::type
|
||||
class ChainedIters<SEQ, disable_if< _is_iterator_of_iterators<SEQ>>
|
||||
>
|
||||
: public IterStateWrapper<typename SEQ::value_type
|
||||
,ChainedIteratorImpl<IterStack<SEQ>, SEQ>
|
||||
|
|
|
|||
|
|
@ -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<typename TY>
|
||||
class is_Typelist
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@
|
|||
|
||||
#include "lib/error.hpp"
|
||||
#include "lib/access-casted.hpp"
|
||||
#include "lib/meta/util.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include <utility>
|
||||
|
|
@ -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 X>
|
||||
typename enable_if< is_constructible<bool,X>,
|
||||
bool >::type
|
||||
enable_if< is_constructible<bool,X>,
|
||||
bool >
|
||||
validitySelfCheck (X const& boolConvertible)
|
||||
{
|
||||
return bool(boolConvertible);
|
||||
}
|
||||
|
||||
template<typename X>
|
||||
typename disable_if< is_constructible<bool,X>,
|
||||
bool >::type
|
||||
disable_if< is_constructible<bool,X>,
|
||||
bool >
|
||||
validitySelfCheck (X const&)
|
||||
{
|
||||
return true; // just pass if this type doesn't provide a validity check...
|
||||
|
|
|
|||
|
|
@ -156,17 +156,13 @@
|
|||
#include "lib/meta/duck-detector.hpp"
|
||||
#include "lib/util.hpp"
|
||||
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
|
||||
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<class API>
|
||||
struct AssignmentPolicy<API, typename enable_if< allow_Clone_but_no_Copy<API> >::type>
|
||||
struct AssignmentPolicy<API, enable_if< allow_Clone_but_no_Copy<API> >>
|
||||
{
|
||||
template<class IMP>
|
||||
static void
|
||||
|
|
@ -316,7 +312,7 @@ namespace lib {
|
|||
* simple \c static_cast without runtime overhead.
|
||||
*/
|
||||
template <class TY>
|
||||
struct Trait<TY, typename enable_if< exposes_CloneFunction<TY> >::type>
|
||||
struct Trait<TY, enable_if< exposes_CloneFunction<TY> >>
|
||||
{
|
||||
typedef TY CopyAPI;
|
||||
enum{ ADMIN_OVERHEAD = 1 * sizeof(void*) };
|
||||
|
|
@ -396,7 +392,7 @@ namespace lib {
|
|||
template<class IMP>
|
||||
PolymorphicValue (IMP*)
|
||||
{
|
||||
BOOST_STATIC_ASSERT (siz >= sizeof(IMP));
|
||||
static_assert (siz >= sizeof(IMP), "insufficient inline buffer size");
|
||||
|
||||
new(&buf_) IMP();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@
|
|||
#include "lib/meta/duck-detector.hpp"
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <memory>
|
||||
|
||||
|
||||
|
|
@ -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<class MOCK>
|
||||
struct ServiceInterface<MOCK, typename enable_if< defines_ServiceInterface<MOCK>>::type>
|
||||
struct ServiceInterface<MOCK, enable_if< defines_ServiceInterface<MOCK> >>
|
||||
{
|
||||
typedef typename MOCK::ServiceInterface Type;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ namespace test {
|
|||
* I decided to allow `<typeinfo>` 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
|
||||
|
|
|
|||
Loading…
Reference in a new issue