| 1 | /*============================================================================== |
| 2 | Copyright (c) 2005 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.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 <utility> |
| 34 | |
| 35 | int main() |
| 36 | { |
| 37 | using boost::phoenix::bind; |
| 38 | using boost::phoenix::placeholders::_1; |
| 39 | |
| 40 | typedef std::pair<int, int> pair_type; |
| 41 | |
| 42 | pair_type pair( 10, 20 ); |
| 43 | |
| 44 | #if defined(BOOST_MSVC) && (BOOST_MSVC >= 1600) && (BOOST_MSVC < 1700) |
| 45 | // bind is being confused with 'std::tr1::_Bind' to be found here |
| 46 | // C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xxbind1(485) |
| 47 | int const & x = boost::phoenix::bind( &pair_type::first, _1 )( pair ); |
| 48 | #else |
| 49 | int const & x = bind( mp: &pair_type::first, obj: _1 )( pair ); |
| 50 | #endif |
| 51 | |
| 52 | BOOST_TEST( &pair.first == &x ); |
| 53 | |
| 54 | return boost::report_errors(); |
| 55 | } |
| 56 | |