From 92ff08b873010b987155b0c1734f8f271edef9a7 Mon Sep 17 00:00:00 2001 From: Tim Blechmann Date: Sat, 7 Dec 2013 12:09:22 +0100 Subject: [PATCH 1/4] bind: silence warning with gcc --- include/boost/bind/arg.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/boost/bind/arg.hpp b/include/boost/bind/arg.hpp index 797e2b7..b761b21 100644 --- a/include/boost/bind/arg.hpp +++ b/include/boost/bind/arg.hpp @@ -22,6 +22,11 @@ #include #include +#if BOOST_GCC >= 40700 +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-local-typedefs" +#endif + namespace boost { @@ -57,4 +62,9 @@ template< int I > struct is_placeholder< arg (*) () > } // namespace boost +#if BOOST_GCC >= 40700 +#pragma GCC diagnostic pop +#endif + + #endif // #ifndef BOOST_BIND_ARG_HPP_INCLUDED From ea05f23163dad64f5f191061e407a7e4e1a7657c Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Wed, 11 Dec 2013 23:58:19 +0200 Subject: [PATCH 2/4] Fixed mem_fn_eq_test to work with /OPT:ICF as per the patch in #8734 by Mike Liang. --- test/mem_fn_eq_test.cpp | 72 ++++++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/test/mem_fn_eq_test.cpp b/test/mem_fn_eq_test.cpp index 17f41f2..544d6ff 100644 --- a/test/mem_fn_eq_test.cpp +++ b/test/mem_fn_eq_test.cpp @@ -39,128 +39,128 @@ struct X // 0 int mf0_1() { return 0; } - int mf0_2() { return 0; } + int mf0_2() { return 1; } int cmf0_1() const { return 0; } - int cmf0_2() const { return 0; } + int cmf0_2() const { return 1; } void mf0v_1() {} - void mf0v_2() {} + void mf0v_2() { static int x; ++x; } void cmf0v_1() const {} - void cmf0v_2() const {} + void cmf0v_2() const { static int x; ++x; } // 1 int mf1_1(int) { return 0; } - int mf1_2(int) { return 0; } + int mf1_2(int) { return 1; } int cmf1_1(int) const { return 0; } - int cmf1_2(int) const { return 0; } + int cmf1_2(int) const { return 1; } void mf1v_1(int) {} - void mf1v_2(int) {} + void mf1v_2(int) { static int x; ++x; } void cmf1v_1(int) const {} - void cmf1v_2(int) const {} + void cmf1v_2(int) const { static int x; ++x; } // 2 int mf2_1(int, int) { return 0; } - int mf2_2(int, int) { return 0; } + int mf2_2(int, int) { return 1; } int cmf2_1(int, int) const { return 0; } - int cmf2_2(int, int) const { return 0; } + int cmf2_2(int, int) const { return 1; } void mf2v_1(int, int) {} - void mf2v_2(int, int) {} + void mf2v_2(int, int) { static int x; ++x; } void cmf2v_1(int, int) const {} - void cmf2v_2(int, int) const {} + void cmf2v_2(int, int) const { static int x; ++x; } // 3 int mf3_1(int, int, int) { return 0; } - int mf3_2(int, int, int) { return 0; } + int mf3_2(int, int, int) { return 1; } int cmf3_1(int, int, int) const { return 0; } - int cmf3_2(int, int, int) const { return 0; } + int cmf3_2(int, int, int) const { return 1; } void mf3v_1(int, int, int) {} - void mf3v_2(int, int, int) {} + void mf3v_2(int, int, int) { static int x; ++x; } void cmf3v_1(int, int, int) const {} - void cmf3v_2(int, int, int) const {} + void cmf3v_2(int, int, int) const { static int x; ++x; } // 4 int mf4_1(int, int, int, int) { return 0; } - int mf4_2(int, int, int, int) { return 0; } + int mf4_2(int, int, int, int) { return 1; } int cmf4_1(int, int, int, int) const { return 0; } - int cmf4_2(int, int, int, int) const { return 0; } + int cmf4_2(int, int, int, int) const { return 1; } void mf4v_1(int, int, int, int) {} - void mf4v_2(int, int, int, int) {} + void mf4v_2(int, int, int, int) { static int x; ++x; } void cmf4v_1(int, int, int, int) const {} - void cmf4v_2(int, int, int, int) const {} + void cmf4v_2(int, int, int, int) const { static int x; ++x; } // 5 int mf5_1(int, int, int, int, int) { return 0; } - int mf5_2(int, int, int, int, int) { return 0; } + int mf5_2(int, int, int, int, int) { return 1; } int cmf5_1(int, int, int, int, int) const { return 0; } - int cmf5_2(int, int, int, int, int) const { return 0; } + int cmf5_2(int, int, int, int, int) const { return 1; } void mf5v_1(int, int, int, int, int) {} - void mf5v_2(int, int, int, int, int) {} + void mf5v_2(int, int, int, int, int) { static int x; ++x; } void cmf5v_1(int, int, int, int, int) const {} - void cmf5v_2(int, int, int, int, int) const {} + void cmf5v_2(int, int, int, int, int) const { static int x; ++x; } // 6 int mf6_1(int, int, int, int, int, int) { return 0; } - int mf6_2(int, int, int, int, int, int) { return 0; } + int mf6_2(int, int, int, int, int, int) { return 1; } int cmf6_1(int, int, int, int, int, int) const { return 0; } - int cmf6_2(int, int, int, int, int, int) const { return 0; } + int cmf6_2(int, int, int, int, int, int) const { return 1; } void mf6v_1(int, int, int, int, int, int) {} - void mf6v_2(int, int, int, int, int, int) {} + void mf6v_2(int, int, int, int, int, int) { static int x; ++x; } void cmf6v_1(int, int, int, int, int, int) const {} - void cmf6v_2(int, int, int, int, int, int) const {} + void cmf6v_2(int, int, int, int, int, int) const { static int x; ++x; } // 7 int mf7_1(int, int, int, int, int, int, int) { return 0; } - int mf7_2(int, int, int, int, int, int, int) { return 0; } + int mf7_2(int, int, int, int, int, int, int) { return 1; } int cmf7_1(int, int, int, int, int, int, int) const { return 0; } - int cmf7_2(int, int, int, int, int, int, int) const { return 0; } + int cmf7_2(int, int, int, int, int, int, int) const { return 1; } void mf7v_1(int, int, int, int, int, int, int) {} - void mf7v_2(int, int, int, int, int, int, int) {} + void mf7v_2(int, int, int, int, int, int, int) { static int x; ++x; } void cmf7v_1(int, int, int, int, int, int, int) const {} - void cmf7v_2(int, int, int, int, int, int, int) const {} + void cmf7v_2(int, int, int, int, int, int, int) const { static int x; ++x; } // 8 int mf8_1(int, int, int, int, int, int, int, int) { return 0; } - int mf8_2(int, int, int, int, int, int, int, int) { return 0; } + int mf8_2(int, int, int, int, int, int, int, int) { return 1; } int cmf8_1(int, int, int, int, int, int, int, int) const { return 0; } - int cmf8_2(int, int, int, int, int, int, int, int) const { return 0; } + int cmf8_2(int, int, int, int, int, int, int, int) const { return 1; } void mf8v_1(int, int, int, int, int, int, int, int) {} - void mf8v_2(int, int, int, int, int, int, int, int) {} + void mf8v_2(int, int, int, int, int, int, int, int) { static int x; ++x; } void cmf8v_1(int, int, int, int, int, int, int, int) const {} - void cmf8v_2(int, int, int, int, int, int, int, int) const {} + void cmf8v_2(int, int, int, int, int, int, int, int) const { static int x; ++x; } }; From a6b17d900155d2a04f54ad18fd89197001f231ab Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Thu, 12 Dec 2013 00:12:56 +0200 Subject: [PATCH 3/4] Switch to BOOST_STATIC_ASSERT in arg.hpp per the patch in #8844. --- include/boost/bind/arg.hpp | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/include/boost/bind/arg.hpp b/include/boost/bind/arg.hpp index 2cc072a..c879bb4 100644 --- a/include/boost/bind/arg.hpp +++ b/include/boost/bind/arg.hpp @@ -21,11 +21,7 @@ #include #include - -#if BOOST_GCC >= 40700 -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wunused-local-typedefs" -#endif +#include namespace boost { @@ -38,8 +34,7 @@ template< int I > struct arg template< class T > arg( T const & /* t */ ) { - // static assert I == is_placeholder::value - typedef char T_must_be_placeholder[ I == is_placeholder::value? 1: -1 ]; + BOOST_STATIC_ASSERT( I == is_placeholder::value ); } }; @@ -64,9 +59,4 @@ template< int I > struct is_placeholder< arg (*) () > } // namespace boost -#if BOOST_GCC >= 40700 -#pragma GCC diagnostic pop -#endif - - #endif // #ifndef BOOST_BIND_ARG_HPP_INCLUDED From dd67e3f7855d554730f21c0eb57f832ae0d4cc8c Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sun, 15 Dec 2013 17:27:54 +0000 Subject: [PATCH 4/4] Link to compose from old version of boost. Compose isn't included in modular boost, so there's nothing to link to. I changed it to link to an old version which still has compose documentation. It might be better to rewrite it? --- bind.html | 2 +- mem_fn.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bind.html b/bind.html index d06d707..d08cdd2 100644 --- a/bind.html +++ b/bind.html @@ -272,7 +272,7 @@ bind(&X::f, p, _1)(i); // (internal copy of p)->f(i)

This feature of bind can be used to perform function composition. See bind_as_compose.cpp for an example that demonstrates how to use bind - to achieve similar functionality to Boost.Compose. + to achieve similar functionality to Boost.Compose.

Note that the first argument - the bound function object - is not evaluated, even when it's a function object that is produced by bind or a diff --git a/mem_fn.html b/mem_fn.html index b54f906..0e9eb12 100644 --- a/mem_fn.html +++ b/mem_fn.html @@ -145,7 +145,7 @@ void k(std::vector<boost::shared_ptr<X> > const & v)

Yes. For simple uses, mem_fn provides additional functionality that the standard adaptors do not. Complicated expressions that use std::bind1st, std::bind2nd - or Boost.Compose along with the + or Boost.Compose along with the standard adaptors can be rewritten using boost::bind that automatically takes advantage of mem_fn.