forked from boostorg/bind
Merge branch 'develop'
This commit is contained in:
14
.travis.yml
14
.travis.yml
@@ -16,9 +16,9 @@ branches:
|
||||
- develop
|
||||
|
||||
install:
|
||||
- git clone -b $TRAVIS_BRANCH https://github.com/boostorg/boost.git boost
|
||||
- cd boost
|
||||
- git submodule init libs/bind
|
||||
- cd ..
|
||||
- git clone -b $TRAVIS_BRANCH https://github.com/boostorg/boost.git boost-root
|
||||
- cd boost-root
|
||||
- git submodule init libs/align
|
||||
- git submodule init libs/assert
|
||||
- git submodule init libs/config
|
||||
@@ -37,9 +37,7 @@ install:
|
||||
- git submodule init tools/build
|
||||
- git submodule init tools/inspect
|
||||
- git submodule update
|
||||
- cd libs/bind
|
||||
- git checkout -q $TRAVIS_COMMIT
|
||||
- cd ../..
|
||||
- cp -r $TRAVIS_BUILD_DIR/* libs/bind
|
||||
- ./bootstrap.sh
|
||||
- ./b2 headers
|
||||
|
||||
@@ -47,3 +45,7 @@ script:
|
||||
- TOOLSET=gcc,clang
|
||||
- if [ $TRAVIS_OS_NAME == osx ]; then TOOLSET=clang; fi
|
||||
- ./b2 libs/bind/test toolset=$TOOLSET
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: always
|
||||
|
12
appveyor.yml
12
appveyor.yml
@@ -12,9 +12,9 @@ branches:
|
||||
- develop
|
||||
|
||||
install:
|
||||
- git clone -b %APPVEYOR_REPO_BRANCH% https://github.com/boostorg/boost.git boost
|
||||
- cd boost
|
||||
- git submodule init libs/bind
|
||||
- cd ..
|
||||
- git clone -b %APPVEYOR_REPO_BRANCH% https://github.com/boostorg/boost.git boost-root
|
||||
- cd boost-root
|
||||
- git submodule init libs/align
|
||||
- git submodule init libs/assert
|
||||
- git submodule init libs/config
|
||||
@@ -33,13 +33,11 @@ install:
|
||||
- git submodule init tools/build
|
||||
- git submodule init tools/inspect
|
||||
- git submodule update
|
||||
- cd libs\bind
|
||||
- git checkout -q %APPVEYOR_REPO_COMMIT%
|
||||
- cd ..\..
|
||||
- xcopy /s /e /q %APPVEYOR_BUILD_FOLDER% libs\bind
|
||||
- bootstrap
|
||||
- b2 headers
|
||||
|
||||
build: off
|
||||
|
||||
test_script:
|
||||
- b2 libs/bind/test toolset=msvc-9.0,msvc-10.0,msvc-11.0,msvc-12.0
|
||||
- b2 libs/bind/test toolset=msvc-9.0,msvc-10.0,msvc-11.0,msvc-14.0
|
||||
|
@@ -21,20 +21,27 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/is_placeholder.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template<bool Eq> struct _arg_eq
|
||||
{
|
||||
};
|
||||
|
||||
template<> struct _arg_eq<true>
|
||||
{
|
||||
typedef void type;
|
||||
};
|
||||
|
||||
template< int I > struct arg
|
||||
{
|
||||
BOOST_CONSTEXPR arg()
|
||||
{
|
||||
}
|
||||
|
||||
template< class T > BOOST_CONSTEXPR arg( T const & /* t */ )
|
||||
template< class T > BOOST_CONSTEXPR arg( T const & /* t */, typename _arg_eq< I == is_placeholder<T>::value >::type * = 0 )
|
||||
{
|
||||
BOOST_STATIC_ASSERT( I == is_placeholder<T>::value );
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -56,4 +56,7 @@ test-suite "bind"
|
||||
[ run bind_type_test.cpp ]
|
||||
[ run bind_unique_ptr_test.cpp ]
|
||||
[ run bind_nested_rv_test.cpp ]
|
||||
[ compile arg_copy_test.cpp ]
|
||||
[ compile-fail arg_copy_fail.cpp ]
|
||||
[ run placeholder_std_bind_test.cpp ]
|
||||
;
|
||||
|
19
test/arg_copy_fail.cpp
Normal file
19
test/arg_copy_fail.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// arg_copy_fail.cpp - arg<1> to arg<2>
|
||||
//
|
||||
// Copyright 2016 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
|
||||
#include <boost/bind/arg.hpp>
|
||||
|
||||
//
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::arg<1> a1(( boost::arg<2>() ));
|
||||
(void)a1;
|
||||
}
|
34
test/arg_copy_test.cpp
Normal file
34
test/arg_copy_test.cpp
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// arg_copy_test.cpp - copying a custom placeholder _1 to arg<1>
|
||||
//
|
||||
// Copyright 2016 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
|
||||
#include <boost/is_placeholder.hpp>
|
||||
#include <boost/bind/arg.hpp>
|
||||
|
||||
//
|
||||
|
||||
template<int I> struct ph
|
||||
{
|
||||
};
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template<int I> struct is_placeholder< ::ph<I> >
|
||||
{
|
||||
enum _vt { value = I };
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::arg<1> a1 = ph<1>();
|
||||
(void)a1;
|
||||
}
|
46
test/placeholder_std_bind_test.cpp
Normal file
46
test/placeholder_std_bind_test.cpp
Normal file
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// placeholder_std_bind_test.cpp - std::bind with Boost's _1
|
||||
//
|
||||
// Copyright 2016 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined( BOOST_NO_CXX11_HDR_FUNCTIONAL )
|
||||
|
||||
int main()
|
||||
{
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <functional>
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
template<int N> struct is_placeholder< boost::arg<N> >: public integral_constant<int, N> {};
|
||||
|
||||
} // namespace std
|
||||
|
||||
int foo( int i )
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
BOOST_TEST_EQ( std::bind( foo, _1 )( 1 ), 1 );
|
||||
BOOST_TEST_EQ( std::bind( foo, _2 )( 1, 2 ), 2 );
|
||||
BOOST_TEST_EQ( std::bind( foo, _3 )( 1, 2, 3 ), 3 );
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user