~twpol/dcplusplus/trunk

« back to all changes in this revision

Viewing changes to boost/boost/spirit/home/phoenix/core/as_actor.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
 
    Copyright (c) 2001-2007 Joel de Guzman
3
 
 
4
 
    Distributed under the Boost Software License, Version 1.0. (See accompanying 
5
 
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
 
==============================================================================*/
7
 
#ifndef PHOENIX_CORE_AS_ACTOR_HPP
8
 
#define PHOENIX_CORE_AS_ACTOR_HPP
9
 
 
10
 
#include <boost/spirit/home/phoenix/core/actor.hpp>
11
 
 
12
 
namespace boost { namespace phoenix
13
 
{
14
 
    template <typename T>
15
 
    struct as_actor_base; // defined in value.hpp
16
 
 
17
 
    template <typename Base>
18
 
    struct as_actor_base<actor<Base> >
19
 
    {
20
 
        typedef Base type;
21
 
 
22
 
        static Base const&
23
 
        convert(actor<Base> const& x)
24
 
        {
25
 
            return x;
26
 
        }
27
 
    };
28
 
 
29
 
    template <>
30
 
    struct as_actor_base<fusion::void_>
31
 
    {
32
 
        typedef fusion::void_ type;
33
 
        struct error_attempting_to_convert_void_type_to_an_actor {};
34
 
 
35
 
        static void
36
 
        convert(error_attempting_to_convert_void_type_to_an_actor);
37
 
    };
38
 
 
39
 
    template <>
40
 
    struct as_actor_base<void>
41
 
    {
42
 
        typedef void type;
43
 
        struct error_attempting_to_convert_void_type_to_an_actor {};
44
 
 
45
 
        static void
46
 
        convert(error_attempting_to_convert_void_type_to_an_actor);
47
 
    };
48
 
 
49
 
    template <typename T>
50
 
    struct as_actor
51
 
    {
52
 
        typedef actor<typename as_actor_base<T>::type> type;
53
 
 
54
 
        static type
55
 
        convert(T const& x)
56
 
        {
57
 
            return as_actor_base<T>::convert(x);
58
 
        }
59
 
    };
60
 
}}
61
 
 
62
 
#endif
 
1
/*=============================================================================
 
2
    Copyright (c) 2001-2007 Joel de Guzman
 
3
 
 
4
    Distributed under the Boost Software License, Version 1.0. (See accompanying 
 
5
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 
6
==============================================================================*/
 
7
#ifndef PHOENIX_CORE_AS_ACTOR_HPP
 
8
#define PHOENIX_CORE_AS_ACTOR_HPP
 
9
 
 
10
#include <boost/spirit/home/phoenix/core/actor.hpp>
 
11
 
 
12
namespace boost { namespace phoenix
 
13
{
 
14
    template <typename T>
 
15
    struct as_actor_base; // defined in value.hpp
 
16
 
 
17
    template <typename Base>
 
18
    struct as_actor_base<actor<Base> >
 
19
    {
 
20
        typedef Base type;
 
21
 
 
22
        static Base const&
 
23
        convert(actor<Base> const& x)
 
24
        {
 
25
            return x;
 
26
        }
 
27
    };
 
28
 
 
29
    template <>
 
30
    struct as_actor_base<fusion::void_>
 
31
    {
 
32
        typedef fusion::void_ type;
 
33
        struct error_attempting_to_convert_void_type_to_an_actor {};
 
34
 
 
35
        static void
 
36
        convert(error_attempting_to_convert_void_type_to_an_actor);
 
37
    };
 
38
 
 
39
    template <>
 
40
    struct as_actor_base<void>
 
41
    {
 
42
        typedef void type;
 
43
        struct error_attempting_to_convert_void_type_to_an_actor {};
 
44
 
 
45
        static void
 
46
        convert(error_attempting_to_convert_void_type_to_an_actor);
 
47
    };
 
48
 
 
49
    template <typename T>
 
50
    struct as_actor
 
51
    {
 
52
        typedef actor<typename as_actor_base<T>::type> type;
 
53
 
 
54
        static type
 
55
        convert(T const& x)
 
56
        {
 
57
            return as_actor_base<T>::convert(x);
 
58
        }
 
59
    };
 
60
}}
 
61
 
 
62
#endif