DAW JSON Link
daw_json_alternate_mapping.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
11#include "daw_json_traits.h"
12#include "version.h"
13
14namespace daw::json {
15 inline namespace DAW_JSON_VER {
16 /***
17 * Allows for alternate mappings of types.
18 * @tparam C Base type to map to
19 * @tparam Idx alternate mapping index
20 */
21 template<typename C, std::size_t Idx = 0>
22 struct json_alt {
23 using type = C;
24 static constexpr std::size_t index = Idx;
25 };
26
27 /***
28 * Default constructor for json_alt is to construct the base type
29 * @tparam T base type to construct
30 * @tparam I index of alternate mapping
31 */
32 template<typename T, std::size_t I>
34 } // namespace DAW_JSON_VER
35} // namespace daw::json
Definition: daw_from_json.h:22
Definition: daw_json_traits.h:199
Definition: daw_json_alternate_mapping.h:22
static constexpr std::size_t index
Definition: daw_json_alternate_mapping.h:24
C type
Definition: daw_json_alternate_mapping.h:23
#define DAW_JSON_VER
The version string used in namespace definitions. Must be a valid namespace name.
Definition: version.h:16