C++
5
Вклад в тег
template <class T, template <typename> class mc>
class property : public mc<T> {
public:
property& operator= (T arg) {
this->Setter(arg);
return *this;
}
operator T() {
return this->Getter();
}
};
template<class T>
class Test {
protected:
T Getter() {
std::cout << ("GET\n");
return n;
}
void Setter(T arg) {
std::cout << ("SET\n");
n = arg;
}
T n;
};
int main() {
property<int, Test> x;
x = 10;
std::cout << "Hello World! << "<< x << "\n";
property<float, Test> y;
y = 5.3f;
std::cout << "Hello World! << "<< y << "\n";
}
setlocale(LC_ALL, "ru-RU.UTF8");
if (argc == 1) {
std::cerr << "Error: Alphabet file not specified\n";
return 1;
}
std::unordered_map <wchar_t, int> alphabet;
std::wifstream alphabet_file(argv[1]);
if (!alphabet_file) {
std::cerr << "Error: Alphabet file not found\n";
return 1;
}
alphabet_file.imbue(std::locale("ru-RU.UTF8"));