Moraxno

Untitled

Jun 5th, 2019
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.10 KB | None | 0 0
  1.         Network::Network(const Network& other)
  2.         {
  3.            this->_nodeList = other._nodeList;
  4.            this->_inputNodeList = other._inputNodeList;
  5.            this->_outputNodeList = other._outputNodeList;
  6.            this->_globalActivation = other._globalActivation;
  7.         }
  8.        
  9.         Network::Network(Network&& other) noexcept
  10.         {
  11.             this->_nodeList = other._nodeList;
  12.             this->_inputNodeList = other._inputNodeList;
  13.             this->_outputNodeList = other._outputNodeList;
  14.             this->_globalActivation = other._globalActivation;
  15.  
  16.             // Deleting only _nodeList, the other 2 are just views and are not used in the destructor.
  17.             for (size_t i = 0; i < other._nodeList.size(); i++)
  18.             {
  19.                other._nodeList[i] = nullptr;
  20.             }
  21.         }
  22.        
  23.         Network& Network::operator=(const Network& other)
  24.         {
  25.             return *this = Network(other);
  26.         }
  27.        
  28.         Network& Network::operator=(Network&& other) noexcept
  29.         {
  30.             return *this = Network(other);
  31.         }
Add Comment
Please, Sign In to add comment