⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 matnodes.h

📁 data structures, algorithms and Application书的源代码
💻 H
字号:
#ifndef MatrixNodes_
#define MatrixNodes_

// node types used by class LinkedMatrix

template <class T> class LinkedMatrix;

template<class T>
class CNode {
   friend LinkedMatrix<T>;
   friend ostream& operator<<
          (ostream&, const LinkedMatrix<T>&);
   friend istream& operator>>
          (istream&, LinkedMatrix<T>&);
   public:
      int operator !=(const CNode<T>& y)
         {return (value != y.value);}
      void Output(ostream& out) const
         {out << "column " << col 
              << " value " << value;}
   private:
      int col;
      T value;
};

template<class T>
ostream& operator<<(ostream& out, const CNode<T>& x)
   {x.Output(out); out << endl; return out;}

template<class T>
class HeadNode {
   friend LinkedMatrix<T>;
   friend ostream& operator<<
          (ostream&, const LinkedMatrix<T>&);
   friend istream& operator>>
          (istream&, LinkedMatrix<T>&);
   public:
      int operator !=(const HeadNode<T>& y)
         {return (row != y.row);}
      void Output(ostream& out) const
         {out << "row " << row;}
   private:
      int row;
      Chain<CNode<T> > a; // row chain
};

template<class T>
ostream& operator<<(ostream& out,
                    const HeadNode<T>& x)
   {x.Output(out); out << endl; return out;}

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -