Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/spirit/phoenix/test/new_test.cpp @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 1.3 KB
Line 
1/*=============================================================================
2    Phoenix V1.2.1
3    Copyright (c) 2001-2003 Joel de Guzman
4    Copyright (c) 2003 Vaclav Vesely
5
6    Use, modification and distribution is subject to the Boost Software
7    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8    http://www.boost.org/LICENSE_1_0.txt)
9==============================================================================*/
10#include <iostream>
11#include <cassert>
12
13#define PHOENIX_LIMIT 15
14#include <boost/spirit/phoenix/primitives.hpp>
15#include <boost/spirit/phoenix/new.hpp>
16
17using namespace phoenix;
18using namespace std;
19
20class X
21{
22public:
23    X(int i_ = 1)
24    :   i(i_)
25    {}
26
27    int i;
28};
29
30///////////////////////////////////////////////////////////////////////////////
31int
32main()
33{
34    int i2 = 2;
35    X   x3(3);
36
37    assert(new_<int>()() != NULL);
38    assert(*new_<int>(arg1)(i2) == 2);
39
40    assert(new_<X>()() != NULL);
41    assert(new_<X>()()->i == 1);
42    assert(new_<X>(arg1)(i2)->i == 2);
43    assert(new_<X>(arg1)(x3)->i == 3);
44
45    cout << "///////////////////////////////////////////////////////////////////////////////\n";
46    cout << "\t\tTests concluded\n";
47    cout << "\t\tSUCCESS!!!\n";
48    cout << "///////////////////////////////////////////////////////////////////////////////\n";
49}
Note: See TracBrowser for help on using the repository browser.