]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/spirit/home/x3/directive/with.hpp
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / boost / spirit / home / x3 / directive / with.hpp
index 153c236b2217702c718d3ee142f23516729fbb51..a092d35c3537249de249f7535d33767ec88950f3 100644 (file)
@@ -21,18 +21,18 @@ namespace boost { namespace spirit { namespace x3
     {
         typedef unary_parser<Subject, Derived> base_type;
         mutable T val;
-        with_value_holder(Subject const& subject, T const& val)
+        with_value_holder(Subject const& subject, T&& val)
           : base_type(subject)
-          , val(val) {}
+          , val(std::forward<T>(val)) {}
     };
     
     template <typename Subject, typename Derived, typename T>
-    struct with_value_holder<Subject, Derived, T const>
+    struct with_value_holder<Subject, Derived, T&>
       : unary_parser<Subject, Derived>
     {
         typedef unary_parser<Subject, Derived> base_type;
-        T val;
-        with_value_holder(Subject const& subject, T const& val)
+        T& val;
+        with_value_holder(Subject const& subject, T& val)
           : base_type(subject)
           , val(val) {}
     };
@@ -47,8 +47,8 @@ namespace boost { namespace spirit { namespace x3
 
         typedef Subject subject_type;
 
-        with_directive(Subject const& subject, T const& val)
-          : base_type(subject, val) {}
+        with_directive(Subject const& subject, T&& val)
+          : base_type(subject, std::forward<T>(val)) {}
 
         template <typename Iterator, typename Context
           , typename RContext, typename Attribute>
@@ -63,44 +63,23 @@ namespace boost { namespace spirit { namespace x3
         }
     };
    
-    template <typename ID, typename T, typename NextContext = unused_type>
-    struct with_context
-    {
-        typedef context<ID, T, NextContext> type;
-    };
-    
-    template <typename ID, typename T>
-    struct with_context<ID, T, unused_type>
-    {
-        typedef context<ID, T> type;
-    };
-
     template <typename ID, typename T>
     struct with_gen
     {
-        T& val;
-
-        with_gen(T& val)
-          : val(val) {}
+        T&& val;
 
         template <typename Subject>
         with_directive<typename extension::as_parser<Subject>::value_type, ID, T>
         operator[](Subject const& subject) const
         {
-            return { as_parser(subject), val };
+            return { as_parser(subject), std::forward<T>(val) };
         }
     };
 
     template <typename ID, typename T>
-    inline with_gen<ID, T> with(T& val)
-    {
-        return { val };
-    }
-    
-    template <typename ID, typename T>
-    inline with_gen<ID, T const> with(T const& val)
+    inline with_gen<ID, T> with(T&& val)
     {
-        return { val };
+        return { std::forward<T>(val) };
     }
 }}}