/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. Distributed under the Boost Software License, Version 1.0. (See accompanying
  6. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. ==============================================================================*/
  8. #include <boost/config.hpp>
  9. #if defined(BOOST_MSVC)
  10. #pragma warning(disable: 4786) // identifier truncated in debug info
  11. #pragma warning(disable: 4710) // function not inlined
  12. #pragma warning(disable: 4711) // function selected for automatic inline expansion
  13. #pragma warning(disable: 4514) // unreferenced inline removed
  14. #endif
  15. #include <boost/phoenix/core.hpp>
  16. #include <boost/phoenix/bind/bind_member_function.hpp>
  17. #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
  18. #pragma warning(push, 3)
  19. #endif
  20. #include <iostream>
  21. #if defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
  22. #pragma warning(pop)
  23. #endif
  24. #include <boost/detail/lightweight_test.hpp>
  25. #include <boost/shared_ptr.hpp>
  26. struct X
  27. {
  28. int v_;
  29. X( int v ): v_( v )
  30. {
  31. }
  32. int f()
  33. {
  34. return v_;
  35. }
  36. };
  37. struct Y
  38. {
  39. boost::shared_ptr<X> f()
  40. {
  41. return boost::shared_ptr<X>( new X( 42 ) );
  42. }
  43. };
  44. int main()
  45. {
  46. using boost::phoenix::bind;
  47. Y y;
  48. BOOST_TEST( bind( &X::f, bind( &Y::f, &y ) )() == 42 );
  49. return boost::report_errors();
  50. }