Thread: std::swap( _Tp&, _Tp& ) calling copy constructor

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Use this: dudeomanodude's Avatar
    Join Date
    Jan 2008
    Location
    Hampton, VA
    Posts
    391
    I'm still getting the privacy issues even after implementing the member swap to swap around members:
    Code:
    void Foo::m_swap( Foo& f ){
      int temp_value = this->m_value;
      this->m_value = f.m_value;
      f.m_value = temp_value;
    }
    What am I doing wrong that I still get the "blah is private within this context" error?

    EDIT: the error is still citing "Foo::Foo( const Foo& )" as the issue? I thought I was avoiding copying now? I'm lost.
    Last edited by dudeomanodude; 12-13-2008 at 10:38 AM.
    Ubuntu Desktop
    GCC/G++
    Geany (for quick projects)
    Anjuta (for larger things)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pointer conversion problems with a copy constructor
    By stanlvw in forum C++ Programming
    Replies: 8
    Last Post: 01-14-2008, 12:06 AM
  2. Copy constructor for Queue ADT (as an Array)
    By clegs in forum C++ Programming
    Replies: 2
    Last Post: 11-28-2007, 11:05 PM
  3. Copy Constructor
    By noobcpp in forum C++ Programming
    Replies: 3
    Last Post: 07-01-2007, 06:29 AM
  4. Replies: 2
    Last Post: 04-04-2007, 06:34 PM
  5. calling default instead of argument constructor, why?!
    By cppn00b in forum C++ Programming
    Replies: 6
    Last Post: 01-30-2005, 04:24 AM