title: Prepend each variadic macro argument with a name of a function parameter in C++
body: <p>I have a macro that is used inside of a class definition for defining as_tuple() member functions.</p>
  
  <pre><code>#define DEFINE_AS_TUPLE(...) \
      auto as_tuple() const \
      { \
          return std::tie(__VA_ARGS__); \
      } \
      auto as_tuple() \
      { \
          return std::tie(__VA_ARGS__); \
      }
  </code></pre>
  
  <p>but I'd like to have a macro for defining class_as_tuple functions outside of a class. In common it should look like this:</p>
  
  <pre><code>#define DEFINE_AS_TUPLE_OUTSIDE_OF_CLASS(ClassName, ...) \
      inline auto class_as_tuple(const ClassName &amp; val) \
      { \
          return std::tie(__VA_ARGS__); \
      } \
      inline auto class_as_tuple(ClassName &amp; val) \
      { \
          return std::tie(__VA_ARGS__); \
      } \
  </code></pre>
  
  <p>but it is not clear how to prepend VA_ARGS with 'val.' in std::tie() call.</p>
  
  <p>To make the question more clear I provided an example of how my first macro is used:</p>
  
  <pre><code>class B
  {
  public:
  
      B() : m_set{ 0, 1, 2 }, m_v{3, 4}
      {
      }
  
      DEFINE_AS_TUPLE(m_set, m_v, m_u8, m_b)
  
  private:
  
      std::set&lt;int&gt; m_set;
      std::vector&lt;int&gt; m_v;
  
      uint8_t m_u8 = 25;
  
      bool m_b = true;
  };
  </code></pre>
  
  <p>but I also need:</p>
  
  <pre><code>DEFINE_AS_TUPLE_OUTSIDE_OF_CLASS(B, m_set, m_v, m_u8, m_b)
  </code></pre>