PageRenderTime 22ms CodeModel.GetById 12ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/libs/phoenix/test/boost_bind_compatibility/bind_rv_sp_test.cpp

http://hadesmem.googlecode.com/
C++ | 66 lines | 43 code | 15 blank | 8 comment | 3 complexity | 69e3b368d0e3bfe68686196ad4529e42 MD5 | raw file
 1/*==============================================================================
 2    Copyright (c) 2006 Peter Dimov
 3    Copyright (c) 2005-2010 Joel de Guzman
 4    Copyright (c) 2010 Thomas Heller
 5
 6    Distributed under the Boost Software License, Version 1.0. (See accompanying
 7    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 8==============================================================================*/
 9
10#include <boost/config.hpp>
11
12#if defined(BOOST_MSVC)
13#pragma warning(disable: 4786)  // identifier truncated in debug info
14#pragma warning(disable: 4710)  // function not inlined
15#pragma warning(disable: 4711)  // function selected for automatic inline expansion
16#pragma warning(disable: 4514)  // unreferenced inline removed
17#endif
18
19#include <boost/phoenix/core.hpp>
20#include <boost/phoenix/bind/bind_member_function.hpp>
21
22#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
23#pragma warning(push, 3)
24#endif
25
26#include <iostream>
27
28#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
29#pragma warning(pop)
30#endif
31
32#include <boost/detail/lightweight_test.hpp>
33#include <boost/shared_ptr.hpp>
34
35struct X
36{
37    int v_;
38
39    X( int v ): v_( v )
40    {
41    }
42
43    int f()
44    {
45        return v_;
46    }
47};
48
49struct Y
50{
51    boost::shared_ptr<X> f()
52    {
53        return boost::shared_ptr<X>( new X( 42 ) );
54    }
55};
56
57int main()
58{
59    using boost::phoenix::bind;
60
61    Y y;
62
63    BOOST_TEST( bind( &X::f, bind( &Y::f, &y ) )() == 42 );
64
65    return boost::report_errors();
66}