Esempio n. 1
0
 const Data& operator[](const String& key) const {
     if (isHash()) {
         const auto it = hash_.find(key);
         if (it == hash_.end()) {
             return kNilData;
         }
         return it->second;
     } else if (isDrop()) {
         return (*drop_)[key];
     } else {
         throw std::runtime_error("[] requires a hash or drop");
     }
 }
Esempio n. 2
0
	PieceType pieceTypeFromOrDropped() const { return (isDrop() ? pieceTypeDropped() : pieceTypeFrom()); }
Esempio n. 3
0
 std::shared_ptr<Drop> drop() const {
     if (!isDrop()) {
         throw std::runtime_error("drop() requires a drop");
     }
     return drop_;
 }
Esempio n. 4
0
	// 移動した後の駒の種類
	PieceType pieceTypeTo() const {
		if(isDrop()) {
			return pieceTypeDropped();
		}
		return pieceTypeTo(pieceTypeFrom());
	}