diff --git a/src/core/meshcop/dataset.hpp b/src/core/meshcop/dataset.hpp index 50ecb2c62..cffa4bcff 100644 --- a/src/core/meshcop/dataset.hpp +++ b/src/core/meshcop/dataset.hpp @@ -770,6 +770,9 @@ public: * * @tparam ValueType The type of TLV's Value. * + * Specializations of this template method are provided for `uint16_t` and `uint32_t` types which ensure big-endian + * encoding is used. + * * @param[in] aType The TLV Type. * @param[in] aValue The TLV Value (of type `ValueType`). * @@ -780,6 +783,9 @@ public: template Error SetTlv(Tlv::Type aType, const ValueType &aValue) { static_assert(!TypeTraits::IsPointer::kValue, "ValueType must not be a pointer"); + static_assert(!TypeTraits::IsSame::kValue, "Specialization must be used for uint16_t"); + static_assert(!TypeTraits::IsSame::kValue, "Specialization must be used for uint32_t"); + static_assert(!TypeTraits::IsSame::kValue, "Specialization must be used for uint64_t"); return SetTlv(aType, &aValue, sizeof(ValueType)); }