|
#pragma once
#include "Alpha.h"
struct testNode
{
testNode(char& _ch) : ch(_ch) {}
void operator() (const Alpha& elem)
{
assert(*elem.get_text().begin() == ch++);
}
private:
char& ch;
};
bool is_a_vowel(const Alpha& elem)
{
std::string chr = elem.get_text();
return chr == "A" || chr == "I" || chr == "O" || chr == "E" || chr == "U";
}
bool comp_if_vowel(const Alpha& lhs, const Alpha& rhs) { return is_a_vowel(lhs) && is_a_vowel(rhs); }
struct set_rank
{
void operator() (Alpha& elem) { elem.set_ranking(*elem.get_text().begin() - 'A');}
};
struct add_one
{
Alpha operator() (Alpha& elem) { elem.set_text(elem.get_text() + "1"); return elem; }
};
struct gen_alpha
{
gen_alpha(char _ch) : ch(_ch) {}
Alpha operator() ()
{
std::ostringstream ostr;
ostr << ch++;
return Alpha(ostr.str());
}
private:
char ch;
};
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.