Open alexey-malov opened 4 years ago
void TransformStream(istream& input, ostream& output, std::function<char(char)> transform);
if (args.mode == Mode.Crypt) { TransformStream(input, output, [key = args.key](char ch) { return Encrypt(char, key); }); } else { TransformStream(input, output, [key = args.key](char ch) { return Decrypt(char, key); }); }
либо даже:
```c++
#include <iterator>
std::transform(
std::istream_iterator<char>(input), (istream_iterator<char>()),
std::ostream_iterator<char>(output),
[key = args.key](char ch) {
return Decrypt(char, key);
});