25 lines
790 B
C++
25 lines
790 B
C++
#include <cstdlib>
|
|
|
|
#include "../turing.cpp"
|
|
|
|
/**
|
|
* @brief Replaces provided string with appriopriate Turing::Instruction<char, char>
|
|
* it takes 'l' character as a left move
|
|
*/
|
|
constexpr Turing::Instruction<char, char> operator ""_i (const char* txt, const size_t len) {
|
|
char cS = *txt++;
|
|
char cV = *txt++;
|
|
char nS = *txt++;
|
|
char nV = *txt++;
|
|
Turing::Movement mv = *txt++ == 'l' ? Turing::Movement::left : Turing::Movement::right;
|
|
return Turing::Instruction<char, char>(cS, cV, nS, nV, mv);
|
|
};
|
|
|
|
// Replaces provided string with aprriopriate vector<char>
|
|
const std::vector<char> operator ""_v (const char* txt, const size_t len) {
|
|
auto rvalue = std::vector<char>(len);
|
|
for (int i = 0; i < len; i++) {
|
|
rvalue[i] = *txt++;
|
|
}
|
|
return rvalue;
|
|
}
|