~ubuntu-branches/debian/sid/boost1.49/sid

« back to all changes in this revision

Viewing changes to libs/python/test/result.cpp

  • Committer: Package Import Robot
  • Author(s): Steve M. Robbins
  • Date: 2012-02-26 00:31:44 UTC
  • Revision ID: package-import@ubuntu.com-20120226003144-eaytp12cbf6ubpms
Tags: upstream-1.49.0
ImportĀ upstreamĀ versionĀ 1.49.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright David Abrahams 2002.
 
2
// Distributed under the Boost Software License, Version 1.0. (See
 
3
// accompanying file LICENSE_1_0.txt or copy at
 
4
// http://www.boost.org/LICENSE_1_0.txt)
 
5
#include <boost/python/detail/result.hpp>
 
6
#include <boost/type.hpp>
 
7
#include <functional>
 
8
 
 
9
using boost::python::detail::result;
 
10
using boost::type;
 
11
 
 
12
void expect_int(type<int>*) {}
 
13
void expect_string(type<char*>*) {}
 
14
 
 
15
struct X {};
 
16
 
 
17
int main()
 
18
{
 
19
    // Test the usage which works for functions, member functions, and data members
 
20
    expect_int(
 
21
        result((int(*)())0)
 
22
        );
 
23
 
 
24
    expect_int(
 
25
        result((int(*)(char))0)
 
26
        );
 
27
 
 
28
    expect_int(
 
29
        result((int(X::*)())0)
 
30
        );
 
31
 
 
32
    expect_int(
 
33
        result((int(X::*)(char))0)
 
34
        );
 
35
 
 
36
    expect_int(
 
37
        result((int(X::*))0)
 
38
        );
 
39
 
 
40
    expect_string(
 
41
        result((char*(*)())0)
 
42
        );
 
43
    
 
44
    expect_string(
 
45
        result((char*(*)(char))0)
 
46
        );
 
47
    
 
48
    expect_string(
 
49
        result((char*(X::*)())0)
 
50
        );
 
51
    
 
52
    expect_string(
 
53
        result((char*(X::*)(char))0)
 
54
        );
 
55
    
 
56
    expect_string(
 
57
        result((char*(X::*))0)
 
58
        );
 
59
    
 
60
    // Show that we can use the general version that works for
 
61
    // AdaptableFunctions
 
62
    expect_int(
 
63
        result((int(*)())0,0)
 
64
        );
 
65
 
 
66
    expect_int(
 
67
        result((int(*)(char))0,0)
 
68
        );
 
69
 
 
70
    expect_int(
 
71
        result((int(X::*)())0,0)
 
72
        );
 
73
 
 
74
    expect_int(
 
75
        result((int(X::*)(char))0,0)
 
76
        );
 
77
 
 
78
    expect_int(
 
79
        result((int(X::*))0,0)
 
80
        );
 
81
    
 
82
    expect_int(
 
83
        result(std::plus<int>(),0)
 
84
        );
 
85
 
 
86
    expect_string(
 
87
        result((char*(*)())0,0)
 
88
        );
 
89
    
 
90
    expect_string(
 
91
        result((char*(*)(char))0,0)
 
92
        );
 
93
    
 
94
    expect_string(
 
95
        result((char*(X::*)())0,0)
 
96
        );
 
97
    
 
98
    expect_string(
 
99
        result((char*(X::*)(char))0,0)
 
100
        );
 
101
    
 
102
    expect_string(
 
103
        result((char*(X::*))0,0)
 
104
        );
 
105
    
 
106
    expect_string(
 
107
        result(std::plus<char*>(),0)
 
108
        );
 
109
 
 
110
    return 0;
 
111
}