Include definition for void_t to avoid dependency on Boost 1.64+

This commit is contained in:
Alexander Grund 2020-07-12 17:46:41 +02:00
parent 823fd994ff
commit d9a10afc12
No known key found for this signature in database
GPG key ID: AA48A0760367A42B
3 changed files with 31 additions and 4 deletions

View file

@ -13,8 +13,8 @@
#include "constraint.hpp" #include "constraint.hpp"
#include "detail/move_helper.hpp" #include "detail/move_helper.hpp"
#include "unwrap_reference.hpp" #include "unwrap_reference.hpp"
#include "detail/void_t.hpp"
#include <boost/version.hpp> #include <boost/version.hpp>
#include <boost/type_traits/make_void.hpp>
#if BOOST_VERSION >= 107000 #if BOOST_VERSION >= 107000
#include <boost/test/tools/floating_point_comparison.hpp> #include <boost/test/tools/floating_point_comparison.hpp>
#else #else
@ -118,7 +118,7 @@ namespace detail
{}; {};
template<class T, class U> template<class T, class U>
struct has_equal_to<T, U, boost::void_t<decltype(std::declval<T>() == std::declval<U>())>>: std::true_type struct has_equal_to<T, U, void_t<decltype(std::declval<T>() == std::declval<U>())>>: std::true_type
{}; {};
template< typename Expected > template< typename Expected >

View file

@ -10,7 +10,7 @@
#define MOCK_IS_FUNCTOR_HPP_INCLUDED #define MOCK_IS_FUNCTOR_HPP_INCLUDED
#include "../config.hpp" #include "../config.hpp"
#include <boost/type_traits/make_void.hpp> #include "void_t.hpp"
#include <type_traits> #include <type_traits>
namespace mock namespace mock
@ -22,7 +22,7 @@ namespace detail
struct is_functor : std::false_type struct is_functor : std::false_type
{}; {};
template< typename F, typename Arg > template< typename F, typename Arg >
struct is_functor< F, Arg, boost::void_t<decltype( std::declval<F>()( std::declval<Arg>() ) )> >: std::true_type struct is_functor< F, Arg, void_t<decltype( std::declval<F>()( std::declval<Arg>() ) )> >: std::true_type
{}; {};
} }
} // mock } // mock

View file

@ -0,0 +1,27 @@
// http://turtle.sourceforge.net
//
// Copyright Alexander Grund 2020
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef MOCK_VOID_T_HPP_INCLUDED
#define MOCK_VOID_T_HPP_INCLUDED
namespace mock
{
namespace detail
{
template<typename...>
struct make_void
{
using type = void;
};
/// Standard helper to implement the detection idiom. Returns always void
template<typename... Ts>
using void_t = typename make_void<Ts...>::type;
}
} // mock
#endif // MOCK_VOID_T_HPP_INCLUDED