Removed is_comparable which is sometimes ambiguous

git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@251 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
mat007 2011-02-21 18:24:30 +00:00
parent 39ccffb881
commit 374cc95c0d
2 changed files with 0 additions and 122 deletions

View file

@ -1,50 +0,0 @@
//
// Copyright Mathieu Champlon 2011
//
// 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_IS_COMPARABLE_HPP_INCLUDED
#define MOCK_IS_COMPARABLE_HPP_INCLUDED
#include "yes_no_type.hpp"
#include "sink.hpp"
#include <boost/type_traits/detail/yes_no_type.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/mpl/bool.hpp>
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable: 4913 )
#endif
namespace mock
{
namespace detail
{
namespace comparable
{
yes_type operator==( sink, sink );
template< typename L, typename R >
struct impl
{
static BOOST_DEDUCED_TYPENAME boost::remove_reference< L >::type* l;
static BOOST_DEDUCED_TYPENAME boost::remove_reference< R >::type* r;
enum { value = sizeof( yes_type(), *l == *r, yes_type() ) == sizeof( yes_type ) };
};
}
template< typename L, typename R >
struct is_comparable : boost::mpl::bool_< comparable::impl< L, R >::value >
{};
}
}
#ifdef _MSC_VER
#pragma warning( pop )
#endif
#endif // #ifndef MOCK_IS_COMPARABLE_HPP_INCLUDED

View file

@ -1,72 +0,0 @@
//
// Copyright Mathieu Champlon 2011
//
// 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)
//
#include <turtle/is_comparable.hpp>
#include <boost/test/auto_unit_test.hpp>
#define BOOST_LIB_NAME boost_unit_test_framework
#include <boost/config/auto_link.hpp>
namespace
{
struct declared_but_not_defined;
struct non_comparable
{};
struct comparable
{};
bool operator==( const comparable&, int );
bool operator==( int, const comparable& );
struct derived_from_comparable : comparable
{};
struct convertible_to_comparable
{
operator comparable() const;
};
template< typename T >
struct template_comparable
{};
template< typename T >
bool operator==( const template_comparable< T >&, int );
template< typename T >
bool operator==( int, const template_comparable< T >& );
struct comparable_to_everything
{
template< typename T >
bool operator==( const T& ) const;
};
}
BOOST_MPL_ASSERT_NOT(( mock::detail::is_comparable< int, declared_but_not_defined > ));
BOOST_MPL_ASSERT_NOT(( mock::detail::is_comparable< declared_but_not_defined, int > ));
BOOST_MPL_ASSERT_NOT(( mock::detail::is_comparable< int, non_comparable > ));
BOOST_MPL_ASSERT_NOT(( mock::detail::is_comparable< non_comparable, int > ));
BOOST_MPL_ASSERT(( mock::detail::is_comparable< int, comparable > ));
BOOST_MPL_ASSERT(( mock::detail::is_comparable< int, comparable& > ));
BOOST_MPL_ASSERT(( mock::detail::is_comparable< int, const comparable& > ));
BOOST_MPL_ASSERT(( mock::detail::is_comparable< comparable, int > ));
BOOST_MPL_ASSERT(( mock::detail::is_comparable< const comparable&, int > ));
BOOST_MPL_ASSERT(( mock::detail::is_comparable< int, template_comparable< int > > ));
BOOST_MPL_ASSERT(( mock::detail::is_comparable< template_comparable< int >, int > ));
BOOST_MPL_ASSERT(( mock::detail::is_comparable< int, derived_from_comparable > ));
BOOST_MPL_ASSERT(( mock::detail::is_comparable< derived_from_comparable, int > ));
BOOST_MPL_ASSERT(( mock::detail::is_comparable< int, convertible_to_comparable > ));
BOOST_MPL_ASSERT(( mock::detail::is_comparable< convertible_to_comparable, int > ));
BOOST_MPL_ASSERT_NOT(( mock::detail::is_comparable< int, comparable_to_everything > ));
BOOST_MPL_ASSERT(( mock::detail::is_comparable< comparable_to_everything, int > ));