squareCompressor.cc
Go to the documentation of this file.
/* squareCompressor.cc
*/
#include "osl/bits/squareCompressor.h"
#include "osl/basic_type.h"
#include <algorithm>
namespace osl
{
CArray<signed char, Square::SIZE> SquareCompressor::positionToIndex;
class SquareCompressor::Initializer
{
public:
Initializer()
{
std::fill(positionToIndex.begin(), positionToIndex.end(), -1);
int cur = 0;
positionToIndex[0] = cur++;
for (int x=1; x<=9; ++x)
{
for (int y=1; y<=9; ++y)
{
positionToIndex[Square(x,y).index()] = cur++;
}
}
assert(cur == 82);
}
};
namespace
{
SquareCompressor::Initializer init;
} // anonymous namespace
}
/* ------------------------------------------------------------------------- */
// ;;; Local Variables:
// ;;; mode:c++
// ;;; c-basic-offset:2
// ;;; End:
basic_type.h
osl::CArray
Definition container.h:20
osl::SquareCompressor::Initializer
Definition squareCompressor.cc:11
osl::SquareCompressor::Initializer::Initializer
Initializer()
Definition squareCompressor.cc:13
osl::Square
Definition basic_type.h:532
osl::Square::index
unsigned int index() const
Definition basic_type.h:572
osl
Definition additionalEffect.h:6
squareCompressor.h
osl::SquareCompressor::positionToIndex
static CArray< signed char, Square::SIZE > positionToIndex
本当はconst にしたいけど初期化が手間なので後回し
Definition squareCompressor.h:19