enum class endian_t = { little, big }; static constexpr endian_t le = endian_t::little; static constexpr endian_t be = endian_t::big; static constexpr endian_t ne = *&((const char&) 1) ? le : be; template T swap_from(const T& t) { if (from == ne) return t; return swap_bytes(t); }