sdbus-c++ 2.4.0
High-level C++ D-Bus library based on systemd D-Bus implementation
Loading...
Searching...
No Matches
TypeTraits.h
Go to the documentation of this file.
1
26
27#ifndef SDBUS_CXX_TYPETRAITS_H_
28#define SDBUS_CXX_TYPETRAITS_H_
29
30#include <sdbus-c++/Error.h>
31
32#include <array>
33#include <cstdint>
34#include <functional>
35#include <map>
36#include <memory>
37#include <optional>
38#ifdef __has_include
39# if __has_include(<span>)
40# include <span>
41# endif
42#endif
43#include <string>
44#include <string_view>
45#include <tuple>
46#include <type_traits>
47#include <unordered_map>
48#include <utility>
49#include <variant>
50#include <vector>
51
52// Forward declarations
53namespace sdbus {
54 class Variant;
55 template <typename... ValueTypes> class Struct;
56 class ObjectPath;
57 class Signature;
58 class UnixFd;
59 template<typename T1, typename T2> using DictEntry = std::pair<T1, T2>;
60 class BusName;
61 class InterfaceName;
62 class MemberName;
63 class MethodCall;
64 class MethodReply;
65 class Signal;
66 class Message;
67 class PropertySetCall;
68 class PropertyGetReply;
69 class Track;
70 template <typename... Results> class Result;
71 class Error;
72 template <typename T, typename Enable = void> struct signature_of;
73} // namespace sdbus
74
75namespace sdbus {
76
77 // Callbacks from sdbus-c++
78 using method_callback = std::function<void(MethodCall msg)>;
79 using async_reply_handler = std::function<void(MethodReply reply, std::optional<Error> error)>;
80 using signal_handler = std::function<void(Signal signal)>;
81 using message_handler = std::function<void(Message msg)>;
82 using property_set_callback = std::function<void(PropertySetCall msg)>;
83 using property_get_callback = std::function<void(PropertyGetReply& reply)>;
84 using track_handler = std::function<void(Track track)>;
85
86 // Type-erased RAII-style handle to callbacks/subscriptions registered to sdbus-c++
87 using Slot = std::unique_ptr<void, std::function<void(void*)>>;
88
89 // Tag specifying that an owning handle (so-called slot) of the logical resource shall be provided to the client
90 struct return_slot_t { explicit return_slot_t() = default; };
91 inline constexpr return_slot_t return_slot{};
92 // Tag specifying that the library shall own the slot resulting from the call of the function (so-called floating slot)
93 struct floating_slot_t { explicit floating_slot_t() = default; };
94 inline constexpr floating_slot_t floating_slot{};
95 // Tag denoting the assumption that the caller has already obtained message ownership
96 struct adopt_message_t { explicit adopt_message_t() = default; };
97 inline constexpr adopt_message_t adopt_message{};
98 // Tag denoting the assumption that the caller has already obtained fd ownership
99 struct adopt_fd_t { explicit adopt_fd_t() = default; };
100 inline constexpr adopt_fd_t adopt_fd{};
101 // Tag denoting the assumption that the caller has already obtained track ownership
102 struct adopt_track_t { explicit adopt_track_t() = default; };
103 inline constexpr adopt_track_t adopt_track{};
104 // Tag specifying that the proxy shall not run an event loop thread on its D-Bus connection.
105 // Such proxies are typically created to carry out a simple synchronous D-Bus call(s) and then are destroyed.
106 struct dont_run_event_loop_thread_t { explicit dont_run_event_loop_thread_t() = default; };
107 inline constexpr dont_run_event_loop_thread_t dont_run_event_loop_thread{};
108 // Tag denoting an asynchronous call that returns std::future as a handle
109 struct with_future_t { explicit with_future_t() = default; };
110 inline constexpr with_future_t with_future{};
111 // Tag denoting a call where the reply shouldn't be waited for
112 struct dont_expect_reply_t { explicit dont_expect_reply_t() = default; };
113 inline constexpr dont_expect_reply_t dont_expect_reply{};
114 // Tag denoting that the variant shall embed the other variant as its value, instead of creating a copy
115 struct embed_variant_t { explicit embed_variant_t() = default; };
116 inline constexpr embed_variant_t embed_variant{};
117 // Tag denoting an asynchronous call that returns an awaitable as a handle
118 struct with_awaitable_t { explicit with_awaitable_t() = default; };
119 inline constexpr with_awaitable_t with_awaitable{};
120
121 // Helper for static assert
122 template <class... T> constexpr bool always_false = false;
123
124 // Helper operator+ for concatenation of `std::array`s
125 template <typename T, std::size_t N1, std::size_t N2>
126 constexpr std::array<T, N1 + N2> operator+(std::array<T, N1> lhs, std::array<T, N2> rhs);
127
128 // Template specializations for getting D-Bus signatures from C++ types
129 template <typename T>
130 constexpr auto signature_of_v = signature_of<T>::value;
131
132 template <typename T, typename Enable>
134 {
135 static constexpr bool is_valid = false;
136 static constexpr bool is_trivial_dbus_type = false;
137
138 static constexpr void* value = []
139 {
140 // See using-sdbus-c++.md, section "Extending sdbus-c++ type system",
141 // on how to teach sdbus-c++ about your custom types
142 static_assert(always_false<T>, "Unsupported D-Bus type (specialize `signature_of` for your custom types)");
143 };
144 };
145
146 template <typename T>
147 struct signature_of<const T> : signature_of<T>
148 {};
149
150 template <typename T>
151 struct signature_of<volatile T> : signature_of<T>
152 {};
153
154 template <typename T>
155 struct signature_of<const volatile T> : signature_of<T>
156 {};
157
158 template <typename T>
160 {};
161
162 template <typename T>
164 {};
165
166 template <>
167 struct signature_of<void>
168 {
169 static constexpr std::array<char, 0> value{};
170 static constexpr bool is_valid = true;
171 static constexpr bool is_trivial_dbus_type = false;
172 };
173
174 template <>
175 struct signature_of<bool>
176 {
177 static constexpr std::array value{'b'};
178 static constexpr bool is_valid = true;
179 static constexpr bool is_trivial_dbus_type = true;
180 };
181
182 template <>
183 struct signature_of<uint8_t>
184 {
185 static constexpr std::array value{'y'};
186 static constexpr bool is_valid = true;
187 static constexpr bool is_trivial_dbus_type = true;
188 };
189
190 template <>
191 struct signature_of<int16_t>
192 {
193 static constexpr std::array value{'n'};
194 static constexpr bool is_valid = true;
195 static constexpr bool is_trivial_dbus_type = true;
196 };
197
198 template <>
199 struct signature_of<uint16_t>
200 {
201 static constexpr std::array value{'q'};
202 static constexpr bool is_valid = true;
203 static constexpr bool is_trivial_dbus_type = true;
204 };
205
206 template <>
207 struct signature_of<int32_t>
208 {
209 static constexpr std::array value{'i'};
210 static constexpr bool is_valid = true;
211 static constexpr bool is_trivial_dbus_type = true;
212 };
213
214 template <>
215 struct signature_of<uint32_t>
216 {
217 static constexpr std::array value{'u'};
218 static constexpr bool is_valid = true;
219 static constexpr bool is_trivial_dbus_type = true;
220 };
221
222 template <>
223 struct signature_of<int64_t>
224 {
225 static constexpr std::array value{'x'};
226 static constexpr bool is_valid = true;
227 static constexpr bool is_trivial_dbus_type = true;
228 };
229
230 template <>
231 struct signature_of<uint64_t>
232 {
233 static constexpr std::array value{'t'};
234 static constexpr bool is_valid = true;
235 static constexpr bool is_trivial_dbus_type = true;
236 };
237
238 template <>
239 struct signature_of<double>
240 {
241 static constexpr std::array value{'d'};
242 static constexpr bool is_valid = true;
243 static constexpr bool is_trivial_dbus_type = true;
244 };
245
246 template <>
247 struct signature_of<std::string>
248 {
249 static constexpr std::array value{'s'};
250 static constexpr bool is_valid = true;
251 static constexpr bool is_trivial_dbus_type = false;
252 };
253
254 template <>
255 struct signature_of<std::string_view> : signature_of<std::string>
256 {};
257
258 template <>
261
262 template <>
264 {};
265
266 template <std::size_t N>
267 struct signature_of<char[N]> : signature_of<std::string>
268 {};
269
270 template <std::size_t N>
271 struct signature_of<const char[N]> : signature_of<std::string>
272 {};
273
274 template <>
275 struct signature_of<BusName> : signature_of<std::string>
276 {};
277
278 template <>
280 {};
281
282 template <>
283 struct signature_of<MemberName> : signature_of<std::string>
284 {};
285
286 template <typename... ValueTypes>
287 struct signature_of<Struct<ValueTypes...>>
288 {
289 static constexpr std::array contents = (signature_of_v<ValueTypes> + ...);
290 static constexpr std::array value = std::array{'('} + contents + std::array{')'};
291 static constexpr char type_value{'r'}; /* Not actually used in signatures on D-Bus, see specs */
292 static constexpr bool is_valid = true;
293 static constexpr bool is_trivial_dbus_type = false;
294 };
295
296 template <>
298 {
299 static constexpr std::array value{'v'};
300 static constexpr bool is_valid = true;
301 static constexpr bool is_trivial_dbus_type = false;
302 };
303
304 template <typename... Elements>
305 struct signature_of<std::variant<Elements...>> : signature_of<Variant>
306 {};
307
308 template <>
310 {
311 static constexpr std::array value{'o'};
312 static constexpr bool is_valid = true;
313 static constexpr bool is_trivial_dbus_type = false;
314 };
315
316 template <>
318 {
319 static constexpr std::array value{'g'};
320 static constexpr bool is_valid = true;
321 static constexpr bool is_trivial_dbus_type = false;
322 };
323
324 template <>
326 {
327 static constexpr std::array value{'h'};
328 static constexpr bool is_valid = true;
329 static constexpr bool is_trivial_dbus_type = false;
330 };
331
332 template <typename T1, typename T2>
333 struct signature_of<DictEntry<T1, T2>>
334 {
335 static constexpr std::array value = std::array{'{'} + signature_of_v<std::tuple<T1, T2>> + std::array{'}'};
336 static constexpr char type_value{'e'}; /* Not actually used in signatures on D-Bus, see specs */
337 static constexpr bool is_valid = true;
338 static constexpr bool is_trivial_dbus_type = false;
339 };
340
341 template <typename Element, typename Allocator>
342 struct signature_of<std::vector<Element, Allocator>>
343 {
344 static constexpr std::array value = std::array{'a'} + signature_of_v<Element>;
345 static constexpr bool is_valid = true;
346 static constexpr bool is_trivial_dbus_type = false;
347 };
348
349 template <typename Element, std::size_t Size>
350 struct signature_of<std::array<Element, Size>> : signature_of<std::vector<Element>>
351 {
352 };
353
354#ifdef __cpp_lib_span
355 template <typename Element, std::size_t Extent>
356 struct signature_of<std::span<Element, Extent>> : signature_of<std::vector<Element>>
357 {
358 };
359#endif
360
361 template <typename Enum> // is_const_v and is_volatile_v to avoid ambiguity conflicts with const and volatile specializations of signature_of
362 struct signature_of<Enum, std::enable_if_t<std::is_enum_v<Enum> && !std::is_const_v<Enum> && !std::is_volatile_v<Enum>>>
363 : signature_of<std::underlying_type_t<Enum>>
364 {};
365
366 template <typename Key, typename Value, typename Compare, typename Allocator>
367 struct signature_of<std::map<Key, Value, Compare, Allocator>>
368 {
369 static constexpr std::array value = std::array{'a'} + signature_of_v<DictEntry<Key, Value>>;
370 static constexpr bool is_valid = true;
371 static constexpr bool is_trivial_dbus_type = false;
372 };
373
374 template <typename Key, typename Value, typename Hash, typename KeyEqual, typename Allocator>
375 struct signature_of<std::unordered_map<Key, Value, Hash, KeyEqual, Allocator>>
376 : signature_of<std::map<Key, Value>>
377 {
378 };
379
380 template <typename... Types>
381 struct signature_of<std::tuple<Types...>> // A simple concatenation of signatures of _Types
382 {
383 static constexpr std::array value = (std::array<char, 0>{} + ... + signature_of_v<Types>);
384 static constexpr bool is_valid = false;
385 static constexpr bool is_trivial_dbus_type = false;
386 };
387
388 // To simplify conversions of arrays to C strings
389 template <typename T, std::size_t N>
390 constexpr auto as_null_terminated(std::array<T, N> arr)
391 {
392 return arr + std::array<T, 1>{0};
393 }
394
395 // Function traits implementation inspired by (c) kennytm,
396 // https://github.com/kennytm/utils/blob/master/traits.hpp
397 template <typename Type>
398 struct function_traits : function_traits<decltype(&Type::operator())>
399 {};
400
401 template <typename Type>
402 struct function_traits<const Type> : function_traits<Type>
403 {};
404
405 template <typename Type>
407 {};
408
409 template <typename ReturnType, typename... Args>
411 {
412 using result_type = ReturnType;
413 using arguments_type = std::tuple<Args...>;
414 using decayed_arguments_type = std::tuple<std::decay_t<Args>...>;
415
416 using function_type = ReturnType (Args...);
417
418 static constexpr std::size_t arity = sizeof...(Args);
419
420// template <size_t _Idx, typename _Enabled = void>
421// struct arg;
422//
423// template <size_t _Idx>
424// struct arg<_Idx, std::enable_if_t<(_Idx < arity)>>
425// {
426// typedef std::tuple_element_t<_Idx, arguments_type> type;
427// };
428//
429// template <size_t _Idx>
430// struct arg<_Idx, std::enable_if_t<!(_Idx < arity)>>
431// {
432// typedef void type;
433// };
434
435 template <size_t Idx>
436 struct arg
437 {
438 using type = std::tuple_element_t<Idx, std::tuple<Args...>>;
439 };
440
441 template <size_t Idx>
442 using arg_t = typename arg<Idx>::type;
443 };
444
445 template <typename ReturnType, typename... Args>
446 struct function_traits<ReturnType(Args...)> : function_traits_base<ReturnType, Args...>
447 {
448 static constexpr bool is_async = false;
449 static constexpr bool has_error_param = false;
450 };
451
452 template <typename... Args>
453 struct function_traits<void(std::optional<Error>, Args...)> : function_traits_base<void, Args...>
454 {
455 static constexpr bool has_error_param = true;
456 };
457
458 template <typename... Args>
459 struct function_traits<void(std::optional<Error>&&, Args...)> : function_traits_base<void, Args...>
460 {
461 static constexpr bool has_error_param = true;
462 };
463
464 template <typename... Args>
465 struct function_traits<void(const std::optional<Error>&, Args...)> : function_traits_base<void, Args...>
466 {
467 static constexpr bool has_error_param = true;
468 };
469
470 template <typename... Args, typename... Results>
471 struct function_traits<void(Result<Results...>, Args...)> : function_traits_base<std::tuple<Results...>, Args...>
472 {
473 static constexpr bool is_async = true;
474 using async_result_t = Result<Results...>;
475 };
476
477 template <typename... Args, typename... Results>
478 struct function_traits<void(Result<Results...>&&, Args...)> : function_traits_base<std::tuple<Results...>, Args...>
479 {
480 static constexpr bool is_async = true;
481 using async_result_t = Result<Results...>;
482 };
483
484 template <typename ReturnType, typename... Args>
485 struct function_traits<ReturnType(*)(Args...)> : function_traits<ReturnType(Args...)>
486 {};
487
488 template <typename ClassType, typename ReturnType, typename... Args>
489 struct function_traits<ReturnType(ClassType::*)(Args...)> : function_traits<ReturnType(Args...)>
490 {
491 using owner_type = ClassType &;
492 };
493
494 template <typename ClassType, typename ReturnType, typename... Args>
495 struct function_traits<ReturnType(ClassType::*)(Args...) const> : function_traits<ReturnType(Args...)>
496 {
497 using owner_type = const ClassType &;
498 };
499
500 template <typename ClassType, typename ReturnType, typename... Args>
501 struct function_traits<ReturnType(ClassType::*)(Args...) volatile> : function_traits<ReturnType(Args...)>
502 {
503 using owner_type = volatile ClassType &;
504 };
505
506 template <typename ClassType, typename ReturnType, typename... Args>
507 struct function_traits<ReturnType(ClassType::*)(Args...) const volatile> : function_traits<ReturnType(Args...)>
508 {
509 using owner_type = const volatile ClassType &;
510 };
511
512 template <typename FunctionType>
513 struct function_traits<std::function<FunctionType>> : function_traits<FunctionType>
514 {};
515
516 template <class Function>
517 constexpr auto is_async_method_v = function_traits<Function>::is_async;
518
519 template <class Function>
520 constexpr auto has_error_param_v = function_traits<Function>::has_error_param;
521
522 template <typename T>
523 struct is_optional : std::false_type
524 {};
525
526 template <typename T>
527 struct is_optional<std::optional<T>> : std::true_type
528 {};
529
530 template <typename T>
531 constexpr auto is_optional_v = is_optional<T>::value;
532
533 template <typename FunctionType>
534 using function_arguments_t = typename function_traits<FunctionType>::arguments_type;
535
536 template <typename FunctionType, size_t Idx>
537 using function_argument_t = typename function_traits<FunctionType>::template arg_t<Idx>;
538
539 template <typename FunctionType>
540 constexpr auto function_argument_count_v = function_traits<FunctionType>::arity;
541
542 template <typename FunctionType>
543 using function_result_t = typename function_traits<FunctionType>::result_type;
544
545 template <typename Function>
550
551 template <typename Function>
552 using tuple_of_function_input_arg_types_t = typename tuple_of_function_input_arg_types<Function>::type;
553
554 template <typename Function>
559
560 template <typename Function>
561 using tuple_of_function_output_arg_types_t = typename tuple_of_function_output_arg_types<Function>::type;
562
563 template <typename Function>
564 struct signature_of_function_input_arguments : signature_of<tuple_of_function_input_arg_types_t<Function>>
565 {
566 static std::string value_as_string()
567 {
568 constexpr auto signature = as_null_terminated(signature_of_v<tuple_of_function_input_arg_types_t<Function>>);
569 return signature.data();
570 }
571 };
572
573 template <typename Function>
574 inline const auto signature_of_function_input_arguments_v = signature_of_function_input_arguments<Function>::value_as_string();
575
576 template <typename Function>
577 struct signature_of_function_output_arguments : signature_of<tuple_of_function_output_arg_types_t<Function>>
578 {
579 static std::string value_as_string()
580 {
581 constexpr auto signature = as_null_terminated(signature_of_v<tuple_of_function_output_arg_types_t<Function>>);
582 return signature.data();
583 }
584 };
585
586 template <typename Function>
587 inline const auto signature_of_function_output_arguments_v = signature_of_function_output_arguments<Function>::value_as_string();
588
589 // std::future stuff for return values of async calls
590 template <typename... Args> struct future_return
591 {
592 using type = std::tuple<Args...>;
593 };
594
595 template <> struct future_return<>
596 {
597 using type = void;
598 };
599
600 template <typename Type> struct future_return<Type>
601 {
602 using type = Type;
603 };
604
605 template <typename... Args>
606 using future_return_t = typename future_return<Args...>::type;
607
608 // For awaitable return types, the same scheme from futures can be reused
609 // so just provide an alias for visual distinction between the two
610 template <typename... Args>
611 using awaitable_return_t = typename future_return<Args...>::type;
612
613 // Credit: Piotr Skotnicki (https://stackoverflow.com/a/57639506)
614 template <typename, typename>
615 constexpr bool is_one_of_variants_types = false;
616
617 template <typename... VariantTypes, typename QueriedType>
618 constexpr bool is_one_of_variants_types<std::variant<VariantTypes...>, QueriedType>
619 = (std::is_same_v<QueriedType, VariantTypes> || ...);
620
621 // Wrapper (tag) denoting we want to serialize user-defined struct
622 // into a D-Bus message as a dictionary of strings to variants.
623 template <typename Struct>
624 struct as_dictionary
625 {
626 explicit as_dictionary(const Struct& strct) : m_struct(strct) {}
627 const Struct& m_struct; // NOLINT(cppcoreguidelines-avoid-const-or-ref-data-members)
628 };
629
630 template <typename Type>
631 const Type& as_dictionary_if_struct(const Type& object)
632 {
633 return object; // identity in case _Type is not struct (user-defined structs shall provide an overload)
634 }
635
636 // By default, the dict-as-struct deserialization strategy is strict.
637 // Strict means that every key of the deserialized dictionary must have its counterpart member in the struct, otherwise an exception is thrown.
638 // Relaxed means that a key that does not have a matching struct member is silently ignored.
639 // The behavior can be overridden for user-defined struct by specializing this variable template.
640 template <typename Struct>
641 constexpr auto strict_dict_as_struct_deserialization_v = true;
642
643 // By default, the struct-as-dict serialization strategy is single-level only (as opposed to nested).
644 // Single-level means that only the specific struct is serialized as a dictionary, serializing members that are structs always as structs.
645 // Nested means that the struct *and* its members that are structs are all serialized as a dictionary. If nested strategy is also
646 // defined for the nested struct, then the same behavior applies for that struct, recursively.
647 // The behavior can be overridden for user-defined struct by specializing this variable template.
648 template <typename Struct>
649 constexpr auto nested_struct_as_dict_serialization_v = false;
650
651 namespace detail
652 {
653 template <class Function, class Tuple, typename... Args, std::size_t... I>
654 constexpr decltype(auto) apply_impl( Function&& fun
655 , Result<Args...>&& res
656 , Tuple&& tuple
657 , std::index_sequence<I...> )
658 {
659 return std::forward<Function>(fun)(std::move(res), std::get<I>(std::forward<Tuple>(tuple))...);
660 }
661
662 template <class Function, class Tuple, std::size_t... I>
663 decltype(auto) apply_impl( Function&& fun
664 , std::optional<Error> err
665 , Tuple&& tuple
666 , std::index_sequence<I...> )
667 {
668 return std::forward<Function>(fun)(std::move(err), std::get<I>(std::forward<Tuple>(tuple))...);
669 }
670
671 // For non-void returning functions, apply_impl simply returns function return value (a tuple of values).
672 // For void-returning functions, apply_impl returns an empty tuple.
673 template <class Function, class Tuple, std::size_t... I>
674 constexpr decltype(auto) apply_impl( Function&& fun
675 , Tuple&& tuple
676 , std::index_sequence<I...> )
677 {
678 if constexpr (!std::is_void_v<function_result_t<Function>>)
679 return std::forward<Function>(fun)(std::get<I>(std::forward<Tuple>(tuple))...);
680 else
681 return std::forward<Function>(fun)(std::get<I>(std::forward<Tuple>(tuple))...), std::tuple<>{};
682 }
683 } // namespace detail
684
685 // Convert tuple `t' of values into a list of arguments
686 // and invoke function `f' with those arguments.
687 template <class Function, class Tuple>
688 constexpr decltype(auto) apply(Function&& fun, Tuple&& tuple)
689 {
690 return detail::apply_impl( std::forward<Function>(fun)
691 , std::forward<Tuple>(tuple)
692 , std::make_index_sequence<std::tuple_size_v<std::decay_t<Tuple>>>{} );
693 }
694
695 // Convert tuple `t' of values into a list of arguments
696 // and invoke function `f' with those arguments.
697 template <class Function, class Tuple, typename... Args>
698 constexpr decltype(auto) apply(Function&& fun, Result<Args...>&& res, Tuple&& tuple)
699 {
700 return detail::apply_impl( std::forward<Function>(fun)
701 , std::move(res)
702 , std::forward<Tuple>(tuple)
703 , std::make_index_sequence<std::tuple_size_v<std::decay_t<Tuple>>>{} );
704 }
705
706 // Convert tuple `t' of values into a list of arguments
707 // and invoke function `f' with those arguments.
708 template <class Function, class Tuple>
709 decltype(auto) apply(Function&& fun, std::optional<Error> err, Tuple&& tuple)
710 {
711 return detail::apply_impl( std::forward<Function>(fun)
712 , std::move(err)
713 , std::forward<Tuple>(tuple)
714 , std::make_index_sequence<std::tuple_size_v<std::decay_t<Tuple>>>{} );
715 }
716
717 namespace detail
718 {
719 // Element-wise expansion, as C++17 compatible alternative to std::move/std::copy,
720 // which are only constexpr starting with C++20
721 template <typename T, std::size_t N1, std::size_t N2, std::size_t... I1, std::size_t... I2>
722 constexpr std::array<T, N1 + N2> concat_arrays_impl( [[maybe_unused]] std::array<T, N1> lhs
723 , [[maybe_unused]] std::array<T, N2> rhs
724 , std::index_sequence<I1...>
725 , std::index_sequence<I2...> )
726 {
727 return {std::move(std::get<I1>(lhs))..., std::move(std::get<I2>(rhs))...};
728 }
729 } // namespace detail
730
731 // Convenient concatenation of arrays
732 template <typename T, std::size_t N1, std::size_t N2>
733 constexpr std::array<T, N1 + N2> operator+(std::array<T, N1> lhs, std::array<T, N2> rhs)
734 {
735 return detail::concat_arrays_impl( std::move(lhs)
736 , std::move(rhs)
737 , std::make_index_sequence<N1>{}
738 , std::make_index_sequence<N2>{} );
739 }
740
741} // namespace sdbus
742
743#endif /* SDBUS_CXX_TYPETRAITS_H_ */
std::pair< T1, T2 > DictEntry
Definition Types.h:415
Definition Types.h:228
Definition Error.h:44
Definition Types.h:251
Definition Types.h:271
Definition Message.h:82
Definition Message.h:280
Definition Message.h:305
Definition Types.h:208
Definition Message.h:337
Definition Message.h:328
Definition MethodResult.h:51
Definition Message.h:316
Definition Types.h:295
Definition Types.h:160
Definition Track.h:67
Definition Types.h:320
Definition Types.h:56
Definition TypeTraits.h:99
Definition TypeTraits.h:96
Definition TypeTraits.h:102
Definition TypeTraits.h:112
Definition TypeTraits.h:106
Definition TypeTraits.h:115
Definition TypeTraits.h:93
Definition TypeTraits.h:437
Definition TypeTraits.h:411
Definition TypeTraits.h:399
Definition TypeTraits.h:591
Definition TypeTraits.h:524
Definition TypeTraits.h:90
Definition TypeTraits.h:134
Definition TypeTraits.h:547
Definition TypeTraits.h:118
Definition TypeTraits.h:109