title: Vector Iterator: no match for ‘operator=’
body: <p>Considering the code C++ in the first code snippet below, I am getting the compilation errors indicated in the second snippet. It looks I am doing st wrong when traversing the vector instance. Can you tell me how I can overcome these compilation problems? Thanks. LINE 171 is marked in the code.</p>
  
  <p><strong>SNIPPET 1 (Code)</strong></p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;vector&gt;
  #include &lt;iterator&gt;
  
  class VipAddressSetEntity : BaseEntity
  {
  public:
        VipAddressSetEntity() : BaseEntity() { }
        VipAddressSetEntity(std::string &amp;uuid, std::string &amp;name) : BaseEntity(uuid, name) { }
  
        VipAddressSetEntity(const VipAddressSetEntity &amp;copyin)
        {
         setUUID(copyin.getUUID());
         setName(copyin.getName());
  
         std::vector&lt;VipAddressEntity&gt;::iterator iter;
                 /* LINE 171 is the following*/
         for( iter = copyin.mVipAddressList.begin(); iter !=   copyin.mVipAddressList.end(); iter++ )
         {
                  addVipAddress(*iter);
         }
        }
  
        VipAddressSetEntity operator = (const VipAddressSetEntity &amp;rhs)
        {
          setUUID(rhs.getUUID());
          setName(rhs.getName());
  
          std::vector&lt;VipAddressEntity&gt;::iterator iter;
          for( iter = rhs.mVipAddressList.begin(); iter != rhs.mVipAddressList.end(); iter++ )
          {
                  addVipAddress(*iter);
          }
  
          return *this;
         }
  
         void addVipAddress(VipAddressEntity &amp;entity)
         {
          mVipAddressList.push_back(entity);
             }
  
         VipAddressEntity &amp; getVipAddress(std::string uuid)
         {
          std::vector&lt;VipAddressEntity&gt;::iterator iter;
          for( iter = mVipAddressList.begin(); iter != mVipAddressList.end(); iter++ )
          {
              if(iter-&gt;getUUID() == uuid)
              {
                 return  *iter;
              }
          }
  
              return NULL;
           }
  
  
           const std::vector&lt;VipAddressEntity&gt;&amp; getVipAddressList() const { return  mVipAddressList; }
  
  
   private:
      std::vector&lt;VipAddressEntity&gt; mVipAddressList;
  
  };
  </code></pre>
  
  <p><strong>SNIPPET 2 (Compilation output)</strong></p>
  
  <pre><code> Entity.hpp: In copy constructor   ‘ECLBCP::VipAddressSetEntity::VipAddressSetEntity(const ECLBCP::VipAddressSetEntity&amp;)’:
   Entity.hpp:171:44: error: no match for ‘operator=’ in ‘iter =    copyin.ECLBCP::VipAddressSetEntity::mVipAddressList.std::vector&lt;_Tp,   _Alloc&gt;::begin&lt;ECLBCP::VipAddressEntity, std::allocator&lt;ECLBCP::VipAddressEntity&gt; &gt;()’
   Entity.hpp:171:44: note: candidates are:
   In file included from /usr/include/c++/4.7/bits/stl_algobase.h:68:0,
                    from /usr/include/c++/4.7/bits/char_traits.h:41,
                    from /usr/include/c++/4.7/string:42,
                    from Entity.hpp:11:
   /usr/include/c++/4.7/bits/stl_iterator.h:710:11: note:  __gnu_cxx::__normal_iterator&lt;ECLBCP::VipAddressEntity*,   std::vector&lt;ECLBCP::VipAddressEntity&gt; &gt;&amp;  __gnu_cxx::__normal_iterator&lt;ECLBCP::VipAddressEntity*,   std::vector&lt;ECLBCP::VipAddressEntity&gt; &gt;::operator=(const   __gnu_cxx::__normal_iterator&lt;ECLBCP::VipAddressEntity*,   std::vector&lt;ECLBCP::VipAddressEntity&gt; &gt;&amp;)
   /usr/include/c++/4.7/bits/stl_iterator.h:710:11: note:   no known conversion for     argument 1 from ‘std::vector&lt;ECLBCP::VipAddressEntity&gt;::const_iterator {aka  __gnu_cxx::__normal_iterator&lt;const ECLBCP::VipAddressEntity*,  std::vector&lt;ECLBCP::VipAddressEntity&gt; &gt;}’ to ‘const  __gnu_cxx::__normal_iterator&lt;ECLBCP::VipAddressEntity*,   std::vector&lt;ECLBCP::VipAddressEntity&gt; &gt;&amp;’
  </code></pre>