ユーザ用ツール

サイト用ツール


lang:c:classelement

文書の過去の版を表示しています。


operator を使う。

class Test {
public:
  uint64_t operator[](const uint64_t index) const {
    return data[index];
  }
 
  uint64_t& operator[](const uint64_t index){ 
    return data[index];
  }
 
private:
  uint64_t data[1024];
 
};
Test a;
a[0] = 1;
uint64_t v = a[0];

などで利用できる。

lang/c/classelement.1755421977.txt.gz · 最終更新: by editor

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki