Skip to content

Commit

Permalink
Remove std::unary/binary_function use, they have been removed in C++17
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimov committed Nov 6, 2016
1 parent 21ad529 commit c326d30
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 11 deletions.
11 changes: 0 additions & 11 deletions include/boost/function/function_template.hpp
Expand Up @@ -656,17 +656,6 @@ namespace boost {
BOOST_FUNCTION_TEMPLATE_PARMS
>
class BOOST_FUNCTION_FUNCTION : public function_base

#if BOOST_FUNCTION_NUM_ARGS == 1

, public std::unary_function<T0,R>

#elif BOOST_FUNCTION_NUM_ARGS == 2

, public std::binary_function<T0,T1,R>

#endif

{
public:
#ifndef BOOST_NO_VOID_RETURNS
Expand Down
2 changes: 2 additions & 0 deletions test/Jamfile.v2
Expand Up @@ -66,6 +66,8 @@ import testing ;
[ run libs/function/test/rvalues_test.cpp : : : : ]

[ compile libs/function/test/function_typeof_test.cpp ]

[ run libs/function/test/result_arg_types_test.cpp ]
;
}

40 changes: 40 additions & 0 deletions test/result_arg_types_test.cpp
@@ -0,0 +1,40 @@
// Boost.Function library

// Copyright 2016 Peter Dimov

// Use, modification and distribution is subject to
// 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/function.hpp>
#include <boost/core/is_same.hpp>
#include <boost/core/lightweight_test_trait.hpp>

struct X
{
};

struct Y
{
};

struct Z
{
};

int main()
{
typedef boost::function<X(Y)> F1;

BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<F1::result_type, X> ));
BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<F1::argument_type, Y> ));

typedef boost::function<X(Y, Z)> F2;

BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<F2::result_type, X> ));
BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<F2::first_argument_type, Y> ));
BOOST_TEST_TRAIT_TRUE(( boost::core::is_same<F2::second_argument_type, Z> ));

return boost::report_errors();
}

0 comments on commit c326d30

Please sign in to comment.