1 // Copyright Daniel Wallin 2006. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 #include <boost/parameter/preprocessor.hpp>
6 #include <boost/parameter/name.hpp>
7 #include <boost/type_traits/is_convertible.hpp>
8 #include <boost/tuple/tuple.hpp>
11 #include <boost/utility/enable_if.hpp>
15 namespace mpl = boost::mpl;
18 using boost::is_convertible;
20 BOOST_PARAMETER_NAME(x)
22 // Sun has problems with this syntax:
24 // template1< r* ( template2<x> ) >
26 // Workaround: factor template2<x> into a separate typedef
28 #if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
30 typedef is_convertible<_,char const*> predicate;
32 BOOST_PARAMETER_FUNCTION((int), sfinae, tag,
34 (optional (x, *(predicate), 0))
43 BOOST_PARAMETER_FUNCTION((int), sfinae, tag,
45 (optional (x, *(is_convertible<_,char const*>), 0))
55 typename boost::enable_if<boost::is_same<int,A0>, int>::type
67 assert(sfinae() == 1);
68 assert(sfinae("foo") == 1);
69 assert(sfinae(1) == 0);