1 // Copyright David Abrahams, Daniel Wallin 2005. Use, modification and
2 // distribution is subject to the Boost Software License, Version 1.0.
3 // (See accompanying file LICENSE_1_0.txt or copy at
4 // http://www.boost.org/LICENSE_1_0.txt)
6 #ifndef BASICS_050424_HPP
7 #define BASICS_050424_HPP
9 #include <boost/parameter/keyword.hpp>
10 #include <boost/parameter/parameters.hpp>
11 #include <boost/type_traits/is_same.hpp>
12 #include <boost/assert.hpp>
13 #include <boost/mpl/assert.hpp>
15 #include <boost/detail/lightweight_test.hpp>
19 BOOST_PARAMETER_KEYWORD(tag, name)
20 BOOST_PARAMETER_KEYWORD(tag, value)
21 BOOST_PARAMETER_KEYWORD(tag, index)
22 BOOST_PARAMETER_KEYWORD(tag, tester)
24 using namespace boost::parameter;
26 struct f_parameters // vc6 is happier with inheritance than with a typedef
35 inline double value_default()
41 inline bool equal(T const& x, T const& y)
46 inline bool equal(char const* s1, char const* s2)
49 return !strcmp(s1,s2);
52 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
53 inline bool equal(char* s1, char* s2)
56 return !strcmp(s1,s2);
60 template <class Name, class Value, class Index>
63 values_t(Name const& n, Value const& v, Index const& i)
67 template <class Name_, class Value_, class Index_>
68 void operator()(Name_ const& n_, Value_ const& v_, Index_ const& i_) const
71 // Only VC and its emulators fail this; they seem to have
72 // problems with deducing the constness of string literal
74 #if defined(_MSC_VER) \
75 && (BOOST_WORKAROUND(BOOST_INTEL_CXX_VERSION, <= 700) \
76 || BOOST_WORKAROUND(BOOST_MSVC, < 1310)) \
77 || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
79 BOOST_MPL_ASSERT((boost::is_same<Index,Index_>));
80 BOOST_MPL_ASSERT((boost::is_same<Value,Value_>));
81 BOOST_MPL_ASSERT((boost::is_same<Name,Name_>));
83 BOOST_TEST(equal(n, n_));
84 BOOST_TEST(equal(v, v_));
85 BOOST_TEST(equal(i, i_));
93 template <class Name, class Value, class Index>
94 inline values_t<Name,Value,Index>
95 values(Name const& n, Value const& v, Index const& i)
97 return values_t<Name,Value,Index>(n,v,i);
102 // GCC2 has a problem with char (&)[] deduction, so we'll cast string
105 #if BOOST_WORKAROUND(__GNUC__, == 2) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
106 # define S(s) (char const*)s
111 #endif // BASICS_050424_HPP