cpp-common/bt2c/fmt.hpp: use `wise_enum::string_type` in `EnableIfIsWiseEnum` definition
[babeltrace.git] / src / cpp-common / bt2c / fmt.hpp
1 /*
2 * Copyright (c) 2024 EfficiOS, inc.
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
7 #include "cpp-common/vendor/fmt/format.h" /* IWYU pragma: keep */
8 #include "cpp-common/vendor/wise-enum/wise_enum.h"
9
10 #include "uuid.hpp"
11
12 namespace internal {
13
14 template <typename T>
15 using EnableIfIsWiseEnum =
16 typename std::enable_if<wise_enum::is_wise_enum<T>::value, const char *>::type;
17
18 } /* namespace internal */
19
20 namespace bt2 {
21
22 template <typename T>
23 ::internal::EnableIfIsWiseEnum<T> format_as(const T val) noexcept
24 {
25 return wise_enum::to_string<T>(val);
26 }
27
28 } /* namespace bt2 */
29
30 namespace bt2c {
31
32 template <typename T>
33 ::internal::EnableIfIsWiseEnum<T> format_as(const T val) noexcept
34 {
35 return wise_enum::to_string<T>(val);
36 }
37
38 inline std::string format_as(const UuidView uuid)
39 {
40 return uuid.str();
41 }
42
43 } /* namespace bt2c */
This page took 0.030677 seconds and 4 git commands to generate.