/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* main.cpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: narnaud +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/08/04 16:48:40 by narnaud #+# #+# */ /* Updated: 2022/08/04 16:52:56 by narnaud ### ########.fr */ /* */ /* ************************************************************************** */ #include "Data.h" #include "iostream" #include "stdint.h" uintptr_t serialize(t_Data* ptr) { return reinterpret_cast(ptr); } t_Data* deserialize(uintptr_t raw) { return reinterpret_cast(raw); } int main(void) { t_Data * data = new t_Data; uintptr_t raw; t_Data * ptr; data->content = "Hi"; raw = serialize(data); ptr = deserialize(raw); std::cout << "Original content: " << data->content << std::endl << "Serialized: " << raw << std::endl << "Deserialized: " << ptr->content << std::endl; delete data; return (0); }