~twpol/dcplusplus/trunk

« back to all changes in this revision

Viewing changes to boost/boost/variant/detail/generic_result_type.hpp

  • Committer: James Ross
  • Date: 2010-07-05 00:03:18 UTC
  • mfrom: (1524.1.650 dcplusplus)
  • Revision ID: silver@warwickcompsoc.co.uk-20100705000318-awwqm8ocpp5m47yz
Merged to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
//-----------------------------------------------------------------------------
2
 
// boost variant/detail/generic_result_type.hpp header file
3
 
// See http://www.boost.org for updates, documentation, and revision history.
4
 
//-----------------------------------------------------------------------------
5
 
//
6
 
// Copyright (c) 2003
7
 
// Eric Friedman
8
 
//
9
 
// Distributed under the Boost Software License, Version 1.0. (See
10
 
// accompanying file LICENSE_1_0.txt or copy at
11
 
// http://www.boost.org/LICENSE_1_0.txt)
12
 
 
13
 
#ifndef BOOST_VARIANT_DETAIL_GENERIC_RESULT_TYPE_HPP
14
 
#define BOOST_VARIANT_DETAIL_GENERIC_RESULT_TYPE_HPP
15
 
 
16
 
#include "boost/config.hpp"
17
 
 
18
 
//////////////////////////////////////////////////////////////////////////
19
 
// (workaround) macro BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE
20
 
//
21
 
// On compilers with BOOST_NO_VOID_RETURNS, this macro provides a route
22
 
// to a single syntax for dealing with template functions that may (but
23
 
// not necessarily) return nothing (i.e. void).
24
 
//
25
 
// BOOST_VARIANT_AUX_RETURN_VOID provided for compilers w/ (erroneous?)
26
 
// warnings about non-void functions not returning a value.
27
 
//
28
 
 
29
 
#if !defined(BOOST_NO_VOID_RETURNS)
30
 
 
31
 
#define BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(T) \
32
 
    T   \
33
 
    /**/
34
 
 
35
 
#define BOOST_VARIANT_AUX_RETURN_VOID  \
36
 
    /**/
37
 
 
38
 
#define BOOST_VARIANT_AUX_RETURN_VOID_TYPE \
39
 
    void    \
40
 
    /**/
41
 
 
42
 
#else // defined(BOOST_NO_VOID_RETURNS)
43
 
 
44
 
namespace boost {
45
 
namespace detail { namespace variant {
46
 
 
47
 
struct fake_return_void
48
 
{
49
 
    fake_return_void()
50
 
    {
51
 
    }
52
 
 
53
 
    template <typename T>
54
 
    fake_return_void(const T&)
55
 
    {
56
 
    }
57
 
};
58
 
 
59
 
template <typename T>
60
 
struct no_void_returns_helper
61
 
{
62
 
    typedef T type;
63
 
};
64
 
 
65
 
template <>
66
 
struct no_void_returns_helper<void>
67
 
{
68
 
    typedef fake_return_void type;
69
 
};
70
 
 
71
 
}} // namespace detail::variant
72
 
} // namespace boost
73
 
 
74
 
#define BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(T) \
75
 
    BOOST_DEDUCED_TYPENAME                                           \
76
 
        ::boost::detail::variant::no_void_returns_helper< T >::type  \
77
 
    /**/
78
 
 
79
 
#define BOOST_VARIANT_AUX_RETURN_VOID  \
80
 
    return ::boost::detail::variant::fake_return_void()     \
81
 
    /**/
82
 
 
83
 
#define BOOST_VARIANT_AUX_RETURN_VOID_TYPE  \
84
 
    ::boost::detail::variant::fake_return_void
85
 
 
86
 
#endif // BOOST_NO_VOID_RETURNS workaround
87
 
 
88
 
#endif // BOOST_VARIANT_DETAIL_GENERIC_RESULT_TYPE_HPP
 
1
//-----------------------------------------------------------------------------
 
2
// boost variant/detail/generic_result_type.hpp header file
 
3
// See http://www.boost.org for updates, documentation, and revision history.
 
4
//-----------------------------------------------------------------------------
 
5
//
 
6
// Copyright (c) 2003
 
7
// Eric Friedman
 
8
//
 
9
// Distributed under the Boost Software License, Version 1.0. (See
 
10
// accompanying file LICENSE_1_0.txt or copy at
 
11
// http://www.boost.org/LICENSE_1_0.txt)
 
12
 
 
13
#ifndef BOOST_VARIANT_DETAIL_GENERIC_RESULT_TYPE_HPP
 
14
#define BOOST_VARIANT_DETAIL_GENERIC_RESULT_TYPE_HPP
 
15
 
 
16
#include "boost/config.hpp"
 
17
 
 
18
//////////////////////////////////////////////////////////////////////////
 
19
// (workaround) macro BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE
 
20
//
 
21
// On compilers with BOOST_NO_VOID_RETURNS, this macro provides a route
 
22
// to a single syntax for dealing with template functions that may (but
 
23
// not necessarily) return nothing (i.e. void).
 
24
//
 
25
// BOOST_VARIANT_AUX_RETURN_VOID provided for compilers w/ (erroneous?)
 
26
// warnings about non-void functions not returning a value.
 
27
//
 
28
 
 
29
#if !defined(BOOST_NO_VOID_RETURNS)
 
30
 
 
31
#define BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(T) \
 
32
    T   \
 
33
    /**/
 
34
 
 
35
#define BOOST_VARIANT_AUX_RETURN_VOID  \
 
36
    /**/
 
37
 
 
38
#define BOOST_VARIANT_AUX_RETURN_VOID_TYPE \
 
39
    void    \
 
40
    /**/
 
41
 
 
42
#else // defined(BOOST_NO_VOID_RETURNS)
 
43
 
 
44
namespace boost {
 
45
namespace detail { namespace variant {
 
46
 
 
47
struct fake_return_void
 
48
{
 
49
    fake_return_void()
 
50
    {
 
51
    }
 
52
 
 
53
    template <typename T>
 
54
    fake_return_void(const T&)
 
55
    {
 
56
    }
 
57
};
 
58
 
 
59
template <typename T>
 
60
struct no_void_returns_helper
 
61
{
 
62
    typedef T type;
 
63
};
 
64
 
 
65
template <>
 
66
struct no_void_returns_helper<void>
 
67
{
 
68
    typedef fake_return_void type;
 
69
};
 
70
 
 
71
}} // namespace detail::variant
 
72
} // namespace boost
 
73
 
 
74
#define BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(T) \
 
75
    BOOST_DEDUCED_TYPENAME                                           \
 
76
        ::boost::detail::variant::no_void_returns_helper< T >::type  \
 
77
    /**/
 
78
 
 
79
#define BOOST_VARIANT_AUX_RETURN_VOID  \
 
80
    return ::boost::detail::variant::fake_return_void()     \
 
81
    /**/
 
82
 
 
83
#define BOOST_VARIANT_AUX_RETURN_VOID_TYPE  \
 
84
    ::boost::detail::variant::fake_return_void
 
85
 
 
86
#endif // BOOST_NO_VOID_RETURNS workaround
 
87
 
 
88
#endif // BOOST_VARIANT_DETAIL_GENERIC_RESULT_TYPE_HPP