Code: Select all
namespace gen_sort {
// HACK: outside of List class because of C++ "static const" limitations :(
Code: Select all
namespace gen_sort {
// HACK: outside of List class because of C++ "static const" limitations :(
Code: Select all
#include <string>
// It seems unnatural that:
class THHGTTG {
private:
static const int A2tUQofLtUaE = 42; // OK
static const std::string fortyTwo("42"); //NOT OK
};
Code: Select all
#include <iostream>
#include <array>
struct List {
enum Inst {
GEN_EVASION,
GEN_TRANS,
GEN_TACTICAL,
GEN_KILLER,
GEN_CHECK,
GEN_PAWN,
GEN_QUIET,
GEN_BAD,
GEN_END,
POST_MOVE,
POST_MOVE_SEE,
POST_KILLER,
POST_KILLER_SEE,
POST_BAD,
};
static constexpr std::array<Inst,11> Prog_Main = {{ GEN_TRANS, POST_KILLER, GEN_TACTICAL, POST_MOVE_SEE, GEN_KILLER, POST_KILLER_SEE, GEN_QUIET, POST_MOVE_SEE, GEN_BAD, POST_BAD, GEN_END }};
static constexpr std::array<Inst,9> Prog_QS_Root = {{ GEN_TRANS, POST_KILLER, GEN_TACTICAL, POST_MOVE, GEN_CHECK, POST_KILLER, GEN_PAWN, POST_MOVE, GEN_END }};
static constexpr std::array<Inst,5> Prog_QS = {{ GEN_TRANS, POST_KILLER, GEN_TACTICAL, POST_MOVE, GEN_END }};
static constexpr std::array<Inst,5> Prog_Evasion = {{ GEN_EVASION, POST_MOVE_SEE, GEN_BAD, POST_BAD, GEN_END }};
};
constexpr std::array<List::Inst,11> List::Prog_Main;
constexpr std::array<List::Inst,9> List::Prog_QS_Root;
constexpr std::array<List::Inst,5> List::Prog_QS;
constexpr std::array<List::Inst,5> List::Prog_Evasion;
int main (int argc, char * argv[]) {
for (auto x : List::Prog_Main)
std::cout << x << std::endl;
return 0;
}