Почему бросок не удался? - PullRequest
0 голосов
/ 04 февраля 2019

Я пытаюсь это:

 if constexpr (Bo == ByteOrder::Network && sizeof(T) == 8)
    return reinterpret_cast<T &> 
  (be64toh(reinterpret_cast<make_unsigned_t<T>&>(val)));
 else if constexpr (Bo == ByteOrder::Host && sizeof(T) == 8)
    return reinterpret_cast<T &>(htobe64(reinterpret_cast<make_unsigned_t<T>&>(val)));

В результате:

error: invalid cast of an rvalue expression of type ‘__uint64_t {aka long unsigned int}’ to type ‘long int&’
     return reinterpret_cast<T &>(be64toh(reinterpret_cast<make_unsigned_t<T>&>(val)));
...