Пример #1
0
namespace sad {
  template<typename T> void swap(T &, T &);

  template<typename A, typename B> struct pair {
    void swap(pair &other) noexcept(noexcept(swap(*this, other))); // expected-error {{too many arguments}} expected-note {{declared here}}
  };

  pair<int, int> pi;

  static_assert(!noexcept(pi.swap(pi)), ""); // expected-note {{in instantiation of}}
}
Пример #2
0
bool Piece::isSameColor(GameState instance, pair<int, int> coordinates){
	
	if(instance[coordinates.first()][coordinates.second()].first == pieceColor){
		return true;
	}
	else{
		return false;
	}


int diagonalMoves(GameState instance, pair<int, int> coordinates, int direction){
	pair<int, int> localCoord;
	int movesSoFar = 0;
	
	if(direction == 1){
		localCoord.first() = localCoord.first()-1;
		localCoord.second() = localCoord.second()+1;
		
		if(instance.getBoardConfig()[localCoord.first(), localCoord.second()] != empty){
			return movesSoFar;
		}
		while(instance.getBoardConfig()[localCoord.first(), localCoord.second()] == empty){
	
			movesSoFar = movesSoFar+1;
			localCoord.first() = localCoord.first()-1;
			localCoord.second() = localCoord.second()+1;
			}
		if(instance.getBoardConfig()[localCoord.first(), localCoord.second()] != outofBounds){
		
			if(.isSameColor(currentGameState, pair<localCoord.first(),localCoord.second()>) == false)
				movesSoFar =  movesSoFar+1;
			
		}
		
		return movesSoFar;
	}
Пример #3
0
	void operator()(const pair<int, ButtonKeyPressHandler> &h)
	{
		h.second(target, code);
	}
Пример #4
0
	void operator()(const pair<int, MovieEventHandler> &h)
	{
		h.second(target);
	}
Пример #5
0
	void operator()(const pair<int, ButtonEventHandler> &h)
	{
		h.second(target);
	}