T Deserialize(std::istream& stream, auto... properties)
{
T object = {};
auto FillObject = [&object, &stream] (auto property)
{
stream >> object.*property;
};
FillObject(properties...);
return object;
};
#include <iostream>
#include <string>
struct T {
int x;
std::string y;
};
T Deserialize(std::istream& stream, auto T::*... properties)
{
T object = {};
auto FillObject = [&object, &stream] (auto property)
{
stream >> object.*property;
};
(FillObject(properties), ...);
return object;
};
int main()
{
T r = Deserialize(std::cin, &T::x, &T::y);
std::cout << "<" << r.x << "> <" << r.y << ">" "\n";
return 0;
}