forked from boostorg/concept_check
Workarounds for a nasty vc-7.1 bug that only shows up in the iterator
library tests. [SVN r33866]
This commit is contained in:
@@ -12,19 +12,22 @@
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace concept_checking
|
||||
{
|
||||
template <class Model>
|
||||
struct concept_check
|
||||
struct concept_check_
|
||||
{
|
||||
virtual void failed(Model* x)
|
||||
{
|
||||
x->~Model();
|
||||
}
|
||||
|
||||
int test;
|
||||
};
|
||||
}
|
||||
|
||||
# ifdef BOOST_OLD_CONCEPT_SUPPORT
|
||||
|
||||
namespace concept_checking
|
||||
{
|
||||
template <class Model>
|
||||
struct constraint_check
|
||||
{
|
||||
@@ -32,31 +35,56 @@ namespace boost
|
||||
{
|
||||
x->constraints();
|
||||
}
|
||||
|
||||
int test;
|
||||
};
|
||||
}
|
||||
|
||||
template <class Model>
|
||||
typename mpl::if_c<
|
||||
struct concept_check
|
||||
: mpl::if_c<
|
||||
concept_checking::has_constraints<Model>::value
|
||||
, constraint_check<Model>
|
||||
, concept_check<Model>
|
||||
>::type concept_check_(void(*)(Model));
|
||||
, concept_checking::constraint_check<Model>
|
||||
, concept_checking::concept_check_<Model>
|
||||
>::type
|
||||
{};
|
||||
|
||||
# else
|
||||
|
||||
template <class Model>
|
||||
concept_check<Model> concept_check_(void(*)(Model));
|
||||
struct concept_check
|
||||
: concept_checking::concept_check_<Model>
|
||||
{};
|
||||
|
||||
# endif
|
||||
|
||||
// Usage, in class or function context:
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
||||
|
||||
//
|
||||
// BOOST_CONCEPT_ASSERT((UnaryFunctionConcept<F,bool,int>));
|
||||
// The iterator library sees some really strange errors unless we
|
||||
// use partial specialization to extract the model type with
|
||||
// msvc-7.1
|
||||
//
|
||||
template <class Model>
|
||||
struct concept_check<void(*)(Model)>
|
||||
: concept_check<Model>
|
||||
{ };
|
||||
|
||||
# define BOOST_CONCEPT_ASSERT( ModelInParens ) \
|
||||
enum { BOOST_PP_CAT(boost_concept_check,__LINE__) = \
|
||||
sizeof(boost::concept_check_((void(*) ModelInParens)0).test) \
|
||||
sizeof(::boost::concept_check<void(*) ModelInParens>) \
|
||||
}
|
||||
|
||||
# else
|
||||
|
||||
template <class Model>
|
||||
concept_check<Model>
|
||||
concept_check_(void(*)(Model));
|
||||
|
||||
# define BOOST_CONCEPT_ASSERT( ModelInParens ) \
|
||||
enum { BOOST_PP_CAT(boost_concept_check,__LINE__) = \
|
||||
sizeof(::boost::concept_check_((void(*) ModelInParens)0)) \
|
||||
}
|
||||
|
||||
# endif
|
||||
}
|
||||
|
||||
#endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP
|
||||
|
@@ -12,19 +12,22 @@
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace concept_checking
|
||||
{
|
||||
template <class Model>
|
||||
struct concept_check
|
||||
struct concept_check_
|
||||
{
|
||||
virtual void failed(Model* x)
|
||||
{
|
||||
x->~Model();
|
||||
}
|
||||
|
||||
int test;
|
||||
};
|
||||
}
|
||||
|
||||
# ifdef BOOST_OLD_CONCEPT_SUPPORT
|
||||
|
||||
namespace concept_checking
|
||||
{
|
||||
template <class Model>
|
||||
struct constraint_check
|
||||
{
|
||||
@@ -32,31 +35,56 @@ namespace boost
|
||||
{
|
||||
x->constraints();
|
||||
}
|
||||
|
||||
int test;
|
||||
};
|
||||
}
|
||||
|
||||
template <class Model>
|
||||
typename mpl::if_c<
|
||||
struct concept_check
|
||||
: mpl::if_c<
|
||||
concept_checking::has_constraints<Model>::value
|
||||
, constraint_check<Model>
|
||||
, concept_check<Model>
|
||||
>::type concept_check_(void(*)(Model));
|
||||
, concept_checking::constraint_check<Model>
|
||||
, concept_checking::concept_check_<Model>
|
||||
>::type
|
||||
{};
|
||||
|
||||
# else
|
||||
|
||||
template <class Model>
|
||||
concept_check<Model> concept_check_(void(*)(Model));
|
||||
struct concept_check
|
||||
: concept_checking::concept_check_<Model>
|
||||
{};
|
||||
|
||||
# endif
|
||||
|
||||
// Usage, in class or function context:
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
|
||||
|
||||
//
|
||||
// BOOST_CONCEPT_ASSERT((UnaryFunctionConcept<F,bool,int>));
|
||||
// The iterator library sees some really strange errors unless we
|
||||
// use partial specialization to extract the model type with
|
||||
// msvc-7.1
|
||||
//
|
||||
template <class Model>
|
||||
struct concept_check<void(*)(Model)>
|
||||
: concept_check<Model>
|
||||
{ };
|
||||
|
||||
# define BOOST_CONCEPT_ASSERT( ModelInParens ) \
|
||||
enum { BOOST_PP_CAT(boost_concept_check,__LINE__) = \
|
||||
sizeof(boost::concept_check_((void(*) ModelInParens)0).test) \
|
||||
sizeof(::boost::concept_check<void(*) ModelInParens>) \
|
||||
}
|
||||
|
||||
# else
|
||||
|
||||
template <class Model>
|
||||
concept_check<Model>
|
||||
concept_check_(void(*)(Model));
|
||||
|
||||
# define BOOST_CONCEPT_ASSERT( ModelInParens ) \
|
||||
enum { BOOST_PP_CAT(boost_concept_check,__LINE__) = \
|
||||
sizeof(::boost::concept_check_((void(*) ModelInParens)0)) \
|
||||
}
|
||||
|
||||
# endif
|
||||
}
|
||||
|
||||
#endif // BOOST_CONCEPT_CHECK_MSVC_DWA2006429_HPP
|
||||
|
Reference in New Issue
Block a user