DAW JSON Link
Loading...
Searching...
No Matches
daw_container_traits.h
Go to the documentation of this file.
1// Copyright (c) Darrell Wright
2//
3// Distributed under the Boost Software License, Version 1.0. (See accompanying
4// file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
5//
6// Official repository: https://github.com/beached/daw_json_link
7//
8
9#pragma once
10
12
14
15#include <daw/cpp_17.h>
16
17#include <array>
18#include <cstddef>
19#include <iterator>
20#include <type_traits>
21
22namespace daw::json {
23 inline namespace DAW_JSON_VER {
24 namespace concepts {
25 namespace container_detect {
27 is_container_v, (void)( std::begin( std::declval<T &>( ) ) ),
28 (void)( std::end( std::declval<T &>( ) ) ),
29 (void)( std::declval<typename T::value_type>( ) ),
30 (void)( std::declval<T &>( ).insert(
31 std::end( std::declval<T &>( ) ),
32 std::declval<typename T::value_type>( ) ) ) );
33 } // namespace container_detect
34
35 template<typename T>
36 DAW_JSON_REQUIRES( container_detect::is_container_v<T> )
37 struct container_traits<T DAW_JSON_ENABLEIF_S(
38 container_detect::is_container_v<T> )> : std::true_type {};
39
40 template<typename T, std::size_t N>
41 struct container_traits<std::array<T, N>> : std::true_type {};
42
44 template<typename T>
45 inline constexpr bool is_container_v = container_traits<T>::value;
46 } // namespace concepts
47 } // namespace DAW_JSON_VER
48} // namespace daw::json
#define DAW_JSON_MAKE_REQ_TRAIT(Name,...)
Disable concepts on gcc < 13.3. See https://github.com/beached/daw_json_link/issues/454.
#define DAW_JSON_ENABLEIF_S(...)
#define DAW_JSON_REQUIRES(...)
constexpr bool is_container_v
Is the type deduced or specialized as a container.
Customization point traits.
#define DAW_JSON_VER
The version string used in namespace definitions. Must be a valid namespace name.
Definition version.h:20