Assume nullptr existance

This commit is contained in:
Alexander Grund 2020-07-09 18:41:40 +02:00
parent cf330e8c86
commit f678f4d91f
No known key found for this signature in database
GPG key ID: AA48A0760367A42B
9 changed files with 7 additions and 65 deletions

View file

@ -40,12 +40,6 @@
# error BOOST_FT_MAX_ARITY must be set to MOCK_MAX_ARGS + 1 or higher
#endif
#if !defined(BOOST_NO_CXX11_NULLPTR) && !defined(BOOST_NO_NULLPTR)
# ifndef MOCK_NO_NULLPTR
# define MOCK_NULLPTR
# endif
#endif
#if !defined(BOOST_NO_CXX11_VARIADIC_MACROS) && !defined(BOOST_NO_VARIADIC_MACROS)
# ifndef MOCK_NO_VARIADIC_MACROS
# define MOCK_VARIADIC_MACROS

View file

@ -11,7 +11,6 @@
#include "config.hpp"
#include "constraint.hpp"
#include "detail/addressof.hpp"
#include "detail/move_helper.hpp"
#include <boost/ref.hpp>
#include <boost/version.hpp>
@ -21,6 +20,7 @@
#else
#include <boost/test/floating_point_comparison.hpp>
#endif
#include <memory>
#include <type_traits>
namespace mock
@ -161,12 +161,12 @@ namespace detail
struct same
{
explicit same( const Expected& expected )
: expected_( detail::addressof( boost::unwrap_ref( expected ) ) )
: expected_( std::addressof( boost::unwrap_ref( expected ) ) )
{}
template< typename Actual >
bool operator()( const Actual& actual ) const
{
return detail::addressof( actual ) == expected_;
return std::addressof( actual ) == expected_;
}
friend std::ostream& operator<<( std::ostream& os, const same& s )
{
@ -180,7 +180,7 @@ namespace detail
struct retrieve
{
explicit retrieve( Expected& expected )
: expected_( detail::addressof( boost::unwrap_ref( expected ) ) )
: expected_( std::addressof( boost::unwrap_ref( expected ) ) )
{}
template< typename Actual >
bool operator()( const Actual& actual,
@ -217,7 +217,7 @@ namespace detail
>::value
>* = 0 ) const
{
*expected_ = detail::addressof( actual );
*expected_ = std::addressof( actual );
return true;
}
friend std::ostream& operator<<( std::ostream& s, const retrieve& r )

View file

@ -1,36 +0,0 @@
// http://turtle.sourceforge.net
//
// Copyright Mathieu Champlon 2013
//
// 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_ADDRESSOF_HPP_INCLUDED
#define MOCK_ADDRESSOF_HPP_INCLUDED
#include "../config.hpp"
#include <boost/utility/addressof.hpp>
namespace mock
{
namespace detail
{
using boost::addressof;
#ifdef MOCK_NULLPTR
inline const std::nullptr_t* addressof( const std::nullptr_t& p )
{
return &p;
}
inline std::nullptr_t* addressof( std::nullptr_t& p )
{
return &p;
}
#endif
}
} // mock
#endif // MOCK_ADDRESSOF_HPP_INCLUDED

View file

@ -11,7 +11,7 @@
#include "../config.hpp"
#include "../stream.hpp"
#include "addressof.hpp"
#include <memory.h>
namespace mock
{
@ -21,7 +21,7 @@ namespace detail
struct formatter
{
explicit formatter( const T& t )
: t_( detail::addressof( t ) )
: t_( std::addressof( t ) )
{}
void serialize( stream& s ) const
{

View file

@ -173,12 +173,10 @@ namespace detail
return s << '?';
}
#ifdef MOCK_NULLPTR
inline stream& operator<<( stream& s, std::nullptr_t )
{
return s << "nullptr";
}
#endif
template< typename T >
std::enable_if_t<