title: Pointer to composite class data member - Part 2
body: <p>In addition to my previous question <a href="https://stackoverflow.com/questions/15879071/c-pointer-to-composite-class-data-member">C++: Pointer to composite class data member</a> :</p>
  
  <p>Sorry for not having described my needs. It seems to me a bit complex to explain. But, as asked, please find below a brief description of my problem.</p>
  
  <p>I would like to create a parameter class that is automatically filled from an XML. </p>
  
  <p>To do that, I add each data member of that parameter class into a vector of pointers to members associated with their XML tag names.</p>
  
  <p>During the XML reading all the tag names are read from the XML and all the parameter's values are updated.</p>
  
  <p>I haven't find any way to declare a member pointer to the "stParam1.fVal1" member of my class (see the line commented below).</p>
  
  <p><strong>How can I declare a member pointer to a struct of a class ?</strong></p>
  
  <pre><code>class XmlReader
  {
  public : 
      struct ST_PARAM
      {
          float XmlReader::*ptrFloat;
          string tagName;
      };
  
      void addAttribut(float XmlReader::* pfMembre, string&amp; tagName) {
          ST_PARAM stParam;
          stParam.ptrFloat = pfMembre;
          stParam.tagName = tagName;
          _tstParams.push_back(stParam);
      }
      void ReadParameters(string&amp; fileName){/*...*/}    // Read Xml File and update all parameters in _tstParams 
  
  private:
      vector&lt;ST_PARAM&gt; _tstParams;
  };
  
  class Param : public XmlReader
  {
  public:
      Param() {
          addAttribut((float XmlReader::*)&amp;Param::fVal1, string("XML_TAG_NAME_1"));                // OK
          addAttribut((float XmlReader::*)&amp;Param::fVal2, string("XML_TAG_NAME_2"));                // OK
  
          // addAttribut((float XmlReader::*)&amp;Param::stParam1.fVal1, string("XML_TAG_NAME_3"));    // DON'T WORK -&gt; Syntax is invalid
          //...
          }
  
      // Some more complex parameters types
      typedef struct 
      {
          float fVal1;
          float fVal2;
      }ST_PARAM_1;
      //...
  
      // Declaration of several parameters
      ST_PARAM_1 stParam1;
      F32 fVal1;
      F32 fVal2;
      //...
  };
  
  void test()
  {
      Param myParam;
      myParam.ReadParameters(string("Parameters.xml"));
  }
  </code></pre>