title: C++, return const and non const reference to std::set item
body: <p>There is the class A containing two overloaded methods getItems();</p>
  
  <pre><code>typedef std::vector &lt;int&gt; TItems;
  
  template &lt;typename T&gt;
  class A 
  {
  private:
      T a;
      TItems items;
  
  public:
      A(){}
      A ( const T a_, const TItems &amp; items_) : a(a_) , items (items_) {}
      bool operator () ( const A &lt;T&gt; &amp;aa ) {return a &lt; aa.a;}
      TItems const &amp; getItems() const {return items}
      TItems &amp; getItems() {return items}
  };
  </code></pre>
  
  <p>and the set of A objects</p>
  
  <pre><code>template &lt;typename T&gt;
  struct TSet {typedef std::set &lt;A &lt;T&gt; &gt; Type;};
  </code></pre>
  
  <p>I would like to return const reference / reference to TItems, but only the second method works</p>
  
  <pre><code>int main ()
  {
  TSet &lt;double&gt; ::Type t;
  TSet &lt;double&gt; ::Type::iterator it = t.begin();
  t.insert (A &lt;double&gt;( 5, TItems(10,10)));
  
  const TItems *items = &amp;(it-&gt;getItems()); //OK
  TItems *items = &amp;(it-&gt;getItems()); //Error  
  }
  
  Error   1   error C2440: 'initializing' : cannot convert from 'const TItems *' to 'TItems *
  </code></pre>
  
  <p>Is it the reason that non-constant references enables to modify A objects causing a potential rearrangement od the set? But items of the set are not arranged by A.items but by a.</p>
  
  <p>Is there a way how modify A.items using a non-constant reference?</p>