From 201a7e20d0a14c41f234ea4fbc25f19de8dae213 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 15 Mar 2020 18:13:07 +0300 Subject: [PATCH] Fix argument value selection with an rvalue default. In C++11 mode, when named parameter pack was a single tagged argument, parameter value was not extracted when an rvalue default value was provided by the user (instead, the default value was returned). This commit adds a missing overload for default_r_, which returns the parameter value. Fixes https://github.com/boostorg/parameter/issues/97. --- include/boost/parameter/aux_/tagged_argument.hpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/include/boost/parameter/aux_/tagged_argument.hpp b/include/boost/parameter/aux_/tagged_argument.hpp index 964dd8f..bdc1eb1 100644 --- a/include/boost/parameter/aux_/tagged_argument.hpp +++ b/include/boost/parameter/aux_/tagged_argument.hpp @@ -295,6 +295,15 @@ namespace boost { namespace parameter { namespace aux { return this->get_value(); } + template + inline BOOST_CONSTEXPR reference + operator[]( + ::boost::parameter::aux::default_r_ const& + ) const + { + return this->get_value(); + } + template inline BOOST_CONSTEXPR reference operator[]( @@ -662,7 +671,7 @@ namespace boost { namespace parameter { namespace aux { ::boost::parameter::aux::tagged_argument , ::boost::parameter::aux::arg_list< ::boost::parameter::aux::tagged_argument - > + > > operator,( ::boost::parameter::aux @@ -673,7 +682,7 @@ namespace boost { namespace parameter { namespace aux { ::boost::parameter::aux::tagged_argument , ::boost::parameter::aux::arg_list< ::boost::parameter::aux::tagged_argument - > + > >( *this , ::boost::parameter::aux::arg_list<