Mercurial > hg > vamp-build-and-test
diff DEPENDENCIES/generic/include/boost/log/detail/light_function_pp.hpp @ 101:c530137014c0
Update Boost headers (1.58.0)
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:12:49 +0100 |
parents | 2665513ce2d3 |
children |
line wrap: on
line diff
--- a/DEPENDENCIES/generic/include/boost/log/detail/light_function_pp.hpp Fri Sep 04 12:01:02 2015 +0100 +++ b/DEPENDENCIES/generic/include/boost/log/detail/light_function_pp.hpp Mon Sep 07 11:12:49 2015 +0100 @@ -1,5 +1,5 @@ /* - * Copyright Andrey Semashev 2007 - 2013. + * Copyright Andrey Semashev 2007 - 2015. * 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) @@ -20,18 +20,21 @@ private: struct impl_base { - typedef result_type (*invoke_type)(impl_base* BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), ArgT)); + typedef result_type (*invoke_type)(void* BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), ArgT)); const invoke_type invoke; - typedef impl_base* (*clone_type)(const impl_base*); + typedef impl_base* (*clone_type)(const void*); const clone_type clone; - typedef void (*destroy_type)(impl_base*); + typedef void (*destroy_type)(void*); const destroy_type destroy; impl_base(invoke_type inv, clone_type cl, destroy_type dstr) : invoke(inv), clone(cl), destroy(dstr) { } + + BOOST_DELETED_FUNCTION(impl_base(impl_base const&)) + BOOST_DELETED_FUNCTION(impl_base& operator= (impl_base const&)) }; #if !defined(BOOST_LOG_NO_MEMBER_TEMPLATE_FRIENDS) @@ -59,23 +62,26 @@ #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) explicit impl(FunT&& fun) : impl_base(&this_type::invoke_impl, &this_type::clone_impl, &this_type::destroy_impl), - m_Function(fun) + m_Function(boost::move(fun)) { } #endif // !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - static void destroy_impl(impl_base* self) + static void destroy_impl(void* self) { - delete static_cast< impl* >(self); + delete static_cast< impl* >(static_cast< impl_base* >(self)); } - static impl_base* clone_impl(const impl_base* self) + static impl_base* clone_impl(const void* self) { - return new impl(static_cast< const impl* >(self)->m_Function); + return new impl(static_cast< const impl* >(static_cast< const impl_base* >(self))->m_Function); } - static result_type invoke_impl(impl_base* self BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(BOOST_PP_ITERATION(), ArgT, arg)) + static result_type invoke_impl(void* self BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(BOOST_PP_ITERATION(), ArgT, arg)) { - return static_cast< impl* >(self)->m_Function(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), arg)); + return static_cast< impl* >(static_cast< impl_base* >(self))->m_Function(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), arg)); } + + BOOST_DELETED_FUNCTION(impl(impl const&)) + BOOST_DELETED_FUNCTION(impl& operator= (impl const&)) }; private: @@ -113,12 +119,12 @@ } #else template< typename FunT > - light_function(FunT const& fun, typename disable_if< mpl::or_< move_detail::is_rv< FunT >, is_same< FunT, this_type > >, int >::type = 0) : + light_function(FunT const& fun, typename disable_if_c< is_rv_or_same< FunT, this_type >::value, int >::type = 0) : m_pImpl(new impl< FunT >(fun)) { } template< typename FunT > - light_function(rv< FunT > const& fun, typename disable_if< is_same< typename remove_cv< FunT >::type, this_type >, int >::type = 0) : + light_function(BOOST_RV_REF(FunT) fun, typename disable_if_c< is_cv_same< FunT, this_type >::value, int >::type = 0) : m_pImpl(new impl< typename remove_cv< FunT >::type >(fun)) { } @@ -148,7 +154,7 @@ } light_function& operator= (BOOST_COPY_ASSIGN_REF(this_type) that) { - light_function tmp = that; + light_function tmp = static_cast< this_type const& >(that); this->swap(tmp); return *this; } @@ -175,7 +181,7 @@ } #else template< typename FunT > - typename disable_if< mpl::or_< move_detail::is_rv< FunT >, is_same< FunT, this_type > >, this_type& >::type + typename disable_if_c< is_rv_or_same< FunT, this_type >::value, this_type& >::type operator= (FunT const& fun) { light_function tmp(fun); @@ -189,7 +195,7 @@ return m_pImpl->invoke(m_pImpl BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), arg)); } - BOOST_EXPLICIT_OPERATOR_BOOL() + BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT() bool operator! () const BOOST_NOEXCEPT { return (m_pImpl == NULL); } bool empty() const BOOST_NOEXCEPT { return (m_pImpl == NULL); } void clear() BOOST_NOEXCEPT @@ -203,7 +209,7 @@ void swap(this_type& that) BOOST_NOEXCEPT { - register impl_base* p = m_pImpl; + impl_base* p = m_pImpl; m_pImpl = that.m_pImpl; that.m_pImpl = p; } @@ -223,18 +229,21 @@ private: struct impl_base { - typedef void (*invoke_type)(impl_base* BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), ArgT)); + typedef void (*invoke_type)(void* BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), ArgT)); const invoke_type invoke; - typedef impl_base* (*clone_type)(const impl_base*); + typedef impl_base* (*clone_type)(const void*); const clone_type clone; - typedef void (*destroy_type)(impl_base*); + typedef void (*destroy_type)(void*); const destroy_type destroy; impl_base(invoke_type inv, clone_type cl, destroy_type dstr) : invoke(inv), clone(cl), destroy(dstr) { } + + BOOST_DELETED_FUNCTION(impl_base(impl_base const&)) + BOOST_DELETED_FUNCTION(impl_base& operator= (impl_base const&)) }; #if !defined(BOOST_LOG_NO_MEMBER_TEMPLATE_FRIENDS) @@ -262,23 +271,26 @@ #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) explicit impl(FunT&& fun) : impl_base(&this_type::invoke_impl, &this_type::clone_impl, &this_type::destroy_impl), - m_Function(fun) + m_Function(boost::move(fun)) { } #endif // !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - static void destroy_impl(impl_base* self) + static void destroy_impl(void* self) { - delete static_cast< impl* >(self); + delete static_cast< impl* >(static_cast< impl_base* >(self)); } - static impl_base* clone_impl(const impl_base* self) + static impl_base* clone_impl(const void* self) { - return new impl(static_cast< const impl* >(self)->m_Function); + return new impl(static_cast< const impl* >(static_cast< const impl_base* >(self))->m_Function); } - static result_type invoke_impl(impl_base* self BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(BOOST_PP_ITERATION(), ArgT, arg)) + static result_type invoke_impl(void* self BOOST_PP_ENUM_TRAILING_BINARY_PARAMS(BOOST_PP_ITERATION(), ArgT, arg)) { - static_cast< impl* >(self)->m_Function(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), arg)); + static_cast< impl* >(static_cast< impl_base* >(self))->m_Function(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), arg)); } + + BOOST_DELETED_FUNCTION(impl(impl const&)) + BOOST_DELETED_FUNCTION(impl& operator= (impl const&)) }; private: @@ -315,12 +327,12 @@ } #else template< typename FunT > - light_function(FunT const& fun, typename disable_if< mpl::or_< move_detail::is_rv< FunT >, is_same< FunT, this_type > >, int >::type = 0) : + light_function(FunT const& fun, typename disable_if_c< is_rv_or_same< FunT, this_type >::value, int >::type = 0) : m_pImpl(new impl< FunT >(fun)) { } template< typename FunT > - light_function(rv< FunT > const& fun, typename disable_if< is_same< typename remove_cv< FunT >::type, this_type >, int >::type = 0) : + light_function(BOOST_RV_REF(FunT) fun, typename disable_if_c< is_cv_same< FunT, this_type >::value, int >::type = 0) : m_pImpl(new impl< typename remove_cv< FunT >::type >(fun)) { } @@ -350,7 +362,7 @@ } light_function& operator= (BOOST_COPY_ASSIGN_REF(this_type) that) { - light_function tmp = that; + light_function tmp = static_cast< this_type const& >(that); this->swap(tmp); return *this; } @@ -377,7 +389,7 @@ } #else template< typename FunT > - typename disable_if< mpl::or_< move_detail::is_rv< FunT >, is_same< FunT, this_type > >, this_type& >::type + typename disable_if_c< is_rv_or_same< FunT, this_type >::value, this_type& >::type operator= (FunT const& fun) { light_function tmp(fun); @@ -391,7 +403,7 @@ m_pImpl->invoke(m_pImpl BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), arg)); } - BOOST_EXPLICIT_OPERATOR_BOOL() + BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT() bool operator! () const BOOST_NOEXCEPT { return (m_pImpl == NULL); } bool empty() const BOOST_NOEXCEPT { return (m_pImpl == NULL); } void clear() BOOST_NOEXCEPT @@ -405,7 +417,7 @@ void swap(this_type& that) BOOST_NOEXCEPT { - register impl_base* p = m_pImpl; + impl_base* p = m_pImpl; m_pImpl = that.m_pImpl; that.m_pImpl = p; }