What does the definition below mean in boost library

I am studying the boost library internally and am puzzled by the following definition:

namespace boost {
  namespace container {
    template<typename CharT, typename Traits = std::char_traits<CharT>, 
    typename A = std::allocator<CharT> > 
      class basic_string;
    template<typename CharT, typename Traits, typename A> 
      basic_string< CharT, Traits, A > basic_string< CharT, Traits, A > && 
        operator+(basic_string< CharT, Traits, A > basic_string< CharT,
        Traits, A > && mx, const basic_string< CharT, Traits, A > & y);

What is the meaning of the type basic_string< CharT, Traits, A > basic_string< CharT, Traits, A > && mx? Does this look like a type long long int? Here is the boost link link: boost 1.48.0

+4
source share
2 answers

This might be a problem in the formatting documentation, defining a template for operator+seems like a syntax error to me. However, by checking the corresponding header file, the definition is as follows:

template <class CharT, class Traits, class A> inline
BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A)
   operator+(
   BOOST_RV_REF_3_TEMPL_ARGS(basic_string, CharT, Traits, A) mx
   , const basic_string<CharT,Traits,A>& y)
{
   mx += y;
   return boost::move(mx);
}

Where a macro BOOST_RV_REF_3_TEMPL_ARGSis defined as

#define BOOST_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\
TYPE<ARG1, ARG2, ARG3> && \
//

which looks great to me and differs from the documentation.

+4
source

Interrupting it in half ...

1) This is a template

template<typename CharT, typename Traits, typename A>

2) , rvalue

basic_string< CharT, Traits, A > basic_string< CharT, Traits, A > &&

3) operator+

operator+(basic_string< CharT, Traits, A > basic_string< CharT,
    Traits, A > && mx, const basic_string< CharT, Traits, A > & y);

&& , rvalue ( , ...). lvalue &.

0

All Articles