Merge pull request #9061
085fdea
Add compile-time check for input iterators in ::wire array writing (Lee *!* Clagett)
This commit is contained in:
commit
6d00cf2c2d
|
@ -30,6 +30,7 @@
|
||||||
#include <boost/utility/string_ref.hpp>
|
#include <boost/utility/string_ref.hpp>
|
||||||
#include <boost/range/size.hpp>
|
#include <boost/range/size.hpp>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <iterator>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
|
@ -188,7 +189,13 @@ namespace wire_write
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline std::size_t array_size(std::true_type, const T& source)
|
inline std::size_t array_size(std::true_type, const T& source)
|
||||||
{ return boost::size(source); }
|
{
|
||||||
|
static_assert(
|
||||||
|
!std::is_same<typename std::iterator_traits<typename T::const_iterator>::iterator_category, std::input_iterator_tag>{},
|
||||||
|
"Input iterators must use json (or similar) derived classes directly"
|
||||||
|
);
|
||||||
|
return boost::size(source);
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline constexpr std::size_t array_size(std::false_type, const T&) noexcept
|
inline constexpr std::size_t array_size(std::false_type, const T&) noexcept
|
||||||
|
|
Loading…
Reference in New Issue