LINUX.ORG.RU

История изменений

Исправление Begemoth, (текущая версия) :

struct Message1 {
  std::string id;
  int code;
};

struct Message2 {
  std::string id;
  int code;
};

Message1 m1;
Message2 m2 = struct_cast<Message1>(m1);

Какие есть механизмы в С++, чтобы реализовать шаблон функцию struct_cast?

Исходная версия Begemoth, :

struct Message1 {
  std::string id;
  int code;
};

struct Message2 {
  std::string id;
  int code;
};

Message1 m1;
Message2 m2 = struct_cast<Message1>(m1);

Какие механизмы, чтобы реализовать шаблон функцию struct_cast?