Chris@16: // Copyright David Abrahams 2006. Distributed under the Boost Chris@16: // Software License, Version 1.0. (See accompanying Chris@16: // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: #ifndef BOOST_CONCEPT_DETAIL_HAS_CONSTRAINTS_DWA2006429_HPP Chris@16: # define BOOST_CONCEPT_DETAIL_HAS_CONSTRAINTS_DWA2006429_HPP Chris@16: Chris@16: # include Chris@16: # include Chris@16: # include Chris@16: Chris@16: namespace boost { namespace concepts { Chris@16: Chris@16: namespace detail Chris@16: { Chris@16: Chris@16: // Here we implement the metafunction that detects whether a Chris@16: // constraints metafunction exists Chris@16: typedef char yes; Chris@16: typedef char (&no)[2]; Chris@16: Chris@16: template Chris@16: struct wrap_constraints {}; Chris@16: Chris@16: #if BOOST_WORKAROUND(__SUNPRO_CC, <= 0x580) || defined(__CUDACC__) Chris@16: // Work around the following bogus error in Sun Studio 11, by Chris@16: // turning off the has_constraints function entirely: Chris@16: // Error: complex expression not allowed in dependent template Chris@16: // argument expression Chris@16: inline no has_constraints_(...); Chris@16: #else Chris@16: template Chris@16: inline yes has_constraints_(Model*, wrap_constraints* = 0); Chris@16: inline no has_constraints_(...); Chris@16: #endif Chris@16: } Chris@16: Chris@16: // This would be called "detail::has_constraints," but it has a strong Chris@16: // tendency to show up in error messages. Chris@16: template Chris@16: struct not_satisfied Chris@16: { Chris@16: BOOST_STATIC_CONSTANT( Chris@16: bool Chris@16: , value = sizeof( detail::has_constraints_((Model*)0) ) == sizeof(detail::yes) ); Chris@16: typedef mpl::bool_ type; Chris@16: }; Chris@16: Chris@16: }} // namespace boost::concepts::detail Chris@16: Chris@16: #endif // BOOST_CONCEPT_DETAIL_HAS_CONSTRAINTS_DWA2006429_HPP