boostorg / endian

Boost Endian library
46 stars 49 forks source link

Weird endian_buffer assignment from T when the conversion is explicit #30

Closed viboes closed 5 years ago

viboes commented 6 years ago

Wiven that the conversion from T is explicit, the assignment shouldn't be allowed.

      explicit endian_buffer(T v) noexcept;

      endian_buffer& operator=(T v) noexcept;

Either the conversion is implicit and the assignment is an optimization, or the conversion is explicit and the assignment should be removed.

viboes commented 6 years ago

Note that endian_arithmetic is already implicitly constructible from T. Why endian_arithmetic implicitly constructible from T while endian_buffer is not?

pdimov commented 5 years ago

This all seems to be by design. endian_buffer has no implicit conversions, endian_arithmetic does.