Ticket #2793: function_type_named_parameter.cpp

File function_type_named_parameter.cpp, 1011 bytes (added by Frank Mori Hess, 9 years ago)

compile test for passing function type as named template parameter

Line 
1// Copyright Frank Mori Hess 2009.
2// Distributed under the Boost Software License, Version
3// 1.0. (See accompanying file LICENSE_1_0.txt or copy at
4// http://www.boost.org/LICENSE_1_0.txt)
5
6#include <boost/mpl/assert.hpp>
7#include <boost/parameter.hpp>
8#include <boost/type_traits/is_same.hpp>
9
10namespace parameter = boost::parameter;
11
12namespace test
13{
14  namespace keywords
15  {
16    BOOST_PARAMETER_TEMPLATE_KEYWORD(function_type)
17  } // namespace keywords
18
19  template <typename A0>
20  class X
21  {
22    typedef parameter::parameters<
23        parameter::required<keywords::tag::function_type>
24      > parameter_spec;
25
26  public:
27    // ArgumentPack
28    typedef typename
29      parameter_spec::bind<A0>::type
30      args;
31
32    typedef typename parameter::binding<args, keywords::tag::function_type>::type
33      type;
34  };
35
36  template <typename T>
37  class Y
38  {
39  public:
40    typedef T type;
41  };
42  BOOST_MPL_ASSERT((boost::is_same<X<keywords::function_type<void ()> >::type, Y<void ()>::type>));
43} // namespace test
44