message: define and use C++17 style _v aliases

Create C++17 `foo_v` style aliases and replace all usages of
template `foo<...>::value` with them.

Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: Ic49d669865ab79c234a9dbbe8a52a85e8e7da903
diff --git a/include/sdbusplus/message/append.hpp b/include/sdbusplus/message/append.hpp
index a0ac9b5..0fb1eb8 100644
--- a/include/sdbusplus/message/append.hpp
+++ b/include/sdbusplus/message/append.hpp
@@ -104,6 +104,10 @@
 struct can_append_multiple<std::variant<Args...>> : std::false_type
 {};
 
+template <typename... Args>
+inline constexpr bool can_append_multiple_v =
+    can_append_multiple<Args...>::value;
+
 /** @struct append_single
  *  @brief Utility to append a single C++ element into a sd_bus_message.
  *
@@ -398,7 +402,7 @@
  *  A tuple of 1 entry can be added with sd_bus_message_append_basic.
  *
  *  Note: Some 1-entry tuples may need special handling due to
- *  can_append_multiple::value == false.
+ *  can_append_multiple_v == false.
  */
 template <typename Tuple>
 std::enable_if_t<1 == std::tuple_size_v<Tuple>>
@@ -422,22 +426,21 @@
  *  @tparam Tuple - A tuple of previously analyzed types.
  *  @tparam Arg - The argument to analyze for grouping.
  *
- *  Specialization for when can_append_multiple<Arg> is true.
+ *  Specialization for when can_append_multiple_v<Arg> is true.
  */
 template <typename Tuple, typename Arg>
-std::enable_if_t<
-    can_append_multiple<types::details::type_id_downcast_t<Arg>>::value>
+std::enable_if_t<can_append_multiple_v<types::details::type_id_downcast_t<Arg>>>
     append_grouping(sdbusplus::SdBusInterface* intf, sd_bus_message* m,
                     Tuple&& t, Arg&& arg);
 /** @brief Group a sequence of C++ types for appending into an sd_bus_message.
  *  @tparam Tuple - A tuple of previously analyzed types.
  *  @tparam Arg - The argument to analyze for grouping.
  *
- *  Specialization for when can_append_multiple<Arg> is false.
+ *  Specialization for when can_append_multiple_v<Arg> is false.
  */
 template <typename Tuple, typename Arg>
 std::enable_if_t<
-    !can_append_multiple<types::details::type_id_downcast_t<Arg>>::value>
+    !can_append_multiple_v<types::details::type_id_downcast_t<Arg>>>
     append_grouping(sdbusplus::SdBusInterface* intf, sd_bus_message* m,
                     Tuple&& t, Arg&& arg);
 /** @brief Group a sequence of C++ types for appending into an sd_bus_message.
@@ -445,11 +448,10 @@
  *  @tparam Arg - The argument to analyze for grouping.
  *  @tparam Rest - The remaining arguments left to analyze.
  *
- *  Specialization for when can_append_multiple<Arg> is true.
+ *  Specialization for when can_append_multiple_v<Arg> is true.
  */
 template <typename Tuple, typename Arg, typename... Rest>
-std::enable_if_t<
-    can_append_multiple<types::details::type_id_downcast_t<Arg>>::value>
+std::enable_if_t<can_append_multiple_v<types::details::type_id_downcast_t<Arg>>>
     append_grouping(sdbusplus::SdBusInterface* intf, sd_bus_message* m,
                     Tuple&& t, Arg&& arg, Rest&&... rest);
 /** @brief Group a sequence of C++ types for appending into an sd_bus_message.
@@ -457,17 +459,16 @@
  *  @tparam Arg - The argument to analyze for grouping.
  *  @tparam Rest - The remaining arguments left to analyze.
  *
- *  Specialization for when can_append_multiple<Arg> is false.
+ *  Specialization for when can_append_multiple_v<Arg> is false.
  */
 template <typename Tuple, typename Arg, typename... Rest>
 std::enable_if_t<
-    !can_append_multiple<types::details::type_id_downcast_t<Arg>>::value>
+    !can_append_multiple_v<types::details::type_id_downcast_t<Arg>>>
     append_grouping(sdbusplus::SdBusInterface* intf, sd_bus_message* m,
                     Tuple&& t, Arg&& arg, Rest&&... rest);
 
 template <typename Tuple, typename Arg>
-std::enable_if_t<
-    can_append_multiple<types::details::type_id_downcast_t<Arg>>::value>
+std::enable_if_t<can_append_multiple_v<types::details::type_id_downcast_t<Arg>>>
     append_grouping(sdbusplus::SdBusInterface* intf, sd_bus_message* m,
                     Tuple&& t, Arg&& arg)
 {
@@ -481,7 +482,7 @@
 
 template <typename Tuple, typename Arg>
 std::enable_if_t<
-    !can_append_multiple<types::details::type_id_downcast_t<Arg>>::value>
+    !can_append_multiple_v<types::details::type_id_downcast_t<Arg>>>
     append_grouping(sdbusplus::SdBusInterface* intf, sd_bus_message* m,
                     Tuple&& t, Arg&& arg)
 {
@@ -494,8 +495,7 @@
 }
 
 template <typename Tuple, typename Arg, typename... Rest>
-std::enable_if_t<
-    can_append_multiple<types::details::type_id_downcast_t<Arg>>::value>
+std::enable_if_t<can_append_multiple_v<types::details::type_id_downcast_t<Arg>>>
     append_grouping(sdbusplus::SdBusInterface* intf, sd_bus_message* m,
                     Tuple&& t, Arg&& arg, Rest&&... rest)
 {
@@ -511,7 +511,7 @@
 
 template <typename Tuple, typename Arg, typename... Rest>
 std::enable_if_t<
-    !can_append_multiple<types::details::type_id_downcast_t<Arg>>::value>
+    !can_append_multiple_v<types::details::type_id_downcast_t<Arg>>>
     append_grouping(sdbusplus::SdBusInterface* intf, sd_bus_message* m,
                     Tuple&& t, Arg&& arg, Rest&&... rest)
 {
diff --git a/include/sdbusplus/message/read.hpp b/include/sdbusplus/message/read.hpp
index ea58eec..2e01ec8 100644
--- a/include/sdbusplus/message/read.hpp
+++ b/include/sdbusplus/message/read.hpp
@@ -110,6 +110,9 @@
 struct can_read_multiple<std::variant<Args...>> : std::false_type
 {};
 
+template <typename... Args>
+inline constexpr bool can_read_multiple_v = can_read_multiple<Args...>::value;
+
 /** @struct read_single
  *  @brief Utility to read a single C++ element from a sd_bus_message.
  *
@@ -499,7 +502,7 @@
  *  A tuple of 1 entry can be read with sd_bus_message_read_basic.
  *
  *  Note: Some 1-entry tuples may need special handling due to
- *  can_read_multiple::value == false.
+ *  can_read_multiple_v == false.
  */
 template <typename Tuple>
 std::enable_if_t<1 == std::tuple_size_v<Tuple>>
@@ -523,22 +526,20 @@
  *  @tparam Tuple - A tuple of previously analyzed types.
  *  @tparam Arg - The argument to analyze for grouping.
  *
- *  Specialization for when can_read_multiple<Arg> is true.
+ *  Specialization for when can_read_multiple_v<Arg> is true.
  */
 template <typename Tuple, typename Arg>
-std::enable_if_t<
-    can_read_multiple<types::details::type_id_downcast_t<Arg>>::value>
+std::enable_if_t<can_read_multiple_v<types::details::type_id_downcast_t<Arg>>>
     read_grouping(sdbusplus::SdBusInterface* intf, sd_bus_message* m, Tuple&& t,
                   Arg&& arg);
 /** @brief Group a sequence of C++ types for reading from an sd_bus_message.
  *  @tparam Tuple - A tuple of previously analyzed types.
  *  @tparam Arg - The argument to analyze for grouping.
  *
- *  Specialization for when can_read_multiple<Arg> is false.
+ *  Specialization for when can_read_multiple_v<Arg> is false.
  */
 template <typename Tuple, typename Arg>
-std::enable_if_t<
-    !can_read_multiple<types::details::type_id_downcast_t<Arg>>::value>
+std::enable_if_t<!can_read_multiple_v<types::details::type_id_downcast_t<Arg>>>
     read_grouping(sdbusplus::SdBusInterface* intf, sd_bus_message* m, Tuple&& t,
                   Arg&& arg);
 /** @brief Group a sequence of C++ types for reading from an sd_bus_message.
@@ -546,11 +547,10 @@
  *  @tparam Arg - The argument to analyze for grouping.
  *  @tparam Rest - The remaining arguments left to analyze.
  *
- *  Specialization for when can_read_multiple<Arg> is true.
+ *  Specialization for when can_read_multiple_v<Arg> is true.
  */
 template <typename Tuple, typename Arg, typename... Rest>
-std::enable_if_t<
-    can_read_multiple<types::details::type_id_downcast_t<Arg>>::value>
+std::enable_if_t<can_read_multiple_v<types::details::type_id_downcast_t<Arg>>>
     read_grouping(sdbusplus::SdBusInterface* intf, sd_bus_message* m, Tuple&& t,
                   Arg&& arg, Rest&&... rest);
 /** @brief Group a sequence of C++ types for reading from an sd_bus_message.
@@ -558,17 +558,15 @@
  *  @tparam Arg - The argument to analyze for grouping.
  *  @tparam Rest - The remaining arguments left to analyze.
  *
- *  Specialization for when can_read_multiple<Arg> is false.
+ *  Specialization for when can_read_multiple_v<Arg> is false.
  */
 template <typename Tuple, typename Arg, typename... Rest>
-std::enable_if_t<
-    !can_read_multiple<types::details::type_id_downcast_t<Arg>>::value>
+std::enable_if_t<!can_read_multiple_v<types::details::type_id_downcast_t<Arg>>>
     read_grouping(sdbusplus::SdBusInterface* intf, sd_bus_message* m, Tuple&& t,
                   Arg&& arg, Rest&&... rest);
 
 template <typename Tuple, typename Arg>
-std::enable_if_t<
-    can_read_multiple<types::details::type_id_downcast_t<Arg>>::value>
+std::enable_if_t<can_read_multiple_v<types::details::type_id_downcast_t<Arg>>>
     read_grouping(sdbusplus::SdBusInterface* intf, sd_bus_message* m, Tuple&& t,
                   Arg&& arg)
 {
@@ -581,8 +579,7 @@
 }
 
 template <typename Tuple, typename Arg>
-std::enable_if_t<
-    !can_read_multiple<types::details::type_id_downcast_t<Arg>>::value>
+std::enable_if_t<!can_read_multiple_v<types::details::type_id_downcast_t<Arg>>>
     read_grouping(sdbusplus::SdBusInterface* intf, sd_bus_message* m, Tuple&& t,
                   Arg&& arg)
 {
@@ -595,8 +592,7 @@
 }
 
 template <typename Tuple, typename Arg, typename... Rest>
-std::enable_if_t<
-    can_read_multiple<types::details::type_id_downcast_t<Arg>>::value>
+std::enable_if_t<can_read_multiple_v<types::details::type_id_downcast_t<Arg>>>
     read_grouping(sdbusplus::SdBusInterface* intf, sd_bus_message* m, Tuple&& t,
                   Arg&& arg, Rest&&... rest)
 {
@@ -610,8 +606,7 @@
 }
 
 template <typename Tuple, typename Arg, typename... Rest>
-std::enable_if_t<
-    !can_read_multiple<types::details::type_id_downcast_t<Arg>>::value>
+std::enable_if_t<!can_read_multiple_v<types::details::type_id_downcast_t<Arg>>>
     read_grouping(sdbusplus::SdBusInterface* intf, sd_bus_message* m, Tuple&& t,
                   Arg&& arg, Rest&&... rest)
 {
diff --git a/include/sdbusplus/message/types.hpp b/include/sdbusplus/message/types.hpp
index 3c956b0..3744d15 100644
--- a/include/sdbusplus/message/types.hpp
+++ b/include/sdbusplus/message/types.hpp
@@ -38,6 +38,7 @@
  */
 template <typename... Args>
 constexpr auto type_id();
+
 /** @fn type_id_nonull()
  *  @brief A non-null-terminated version of type_id.
  *
@@ -138,6 +139,9 @@
 #endif
 };
 
+template <char... Chars>
+inline constexpr auto tuple_type_id_v = tuple_type_id<Chars...>::value;
+
 /** @fn type_id_single()
  *  @brief Get a tuple containing the dbus type character(s) for a C++ type.
  *
@@ -172,6 +176,10 @@
     public std::conditional_t<
         std::is_enum_v<T>, tuple_type_id<SD_BUS_TYPE_STRING>, undefined_type_id>
 {};
+
+template <typename... Args>
+inline constexpr auto type_id_v = type_id<Args...>::value;
+
 // Specializations for built-in types.
 template <>
 struct type_id<bool> : tuple_type_id<SD_BUS_TYPE_BOOLEAN>
@@ -225,28 +233,27 @@
 struct type_id<T, std::enable_if_t<utility::has_const_iterator_v<T>>> :
     std::false_type
 {
-    static constexpr auto value = std::tuple_cat(
-        tuple_type_id<SD_BUS_TYPE_ARRAY>::value,
-        type_id<type_id_downcast_t<typename T::value_type>>::value);
+    static constexpr auto value =
+        std::tuple_cat(tuple_type_id_v<SD_BUS_TYPE_ARRAY>,
+                       type_id_v<type_id_downcast_t<typename T::value_type>>);
 };
 
 template <typename T1, typename T2>
 struct type_id<std::pair<T1, T2>>
 {
-    static constexpr auto value =
-        std::tuple_cat(tuple_type_id<SD_BUS_TYPE_DICT_ENTRY_BEGIN>::value,
-                       type_id<type_id_downcast_t<T1>>::value,
-                       type_id<type_id_downcast_t<T2>>::value,
-                       tuple_type_id<SD_BUS_TYPE_DICT_ENTRY_END>::value);
+    static constexpr auto value = std::tuple_cat(
+        tuple_type_id_v<SD_BUS_TYPE_DICT_ENTRY_BEGIN>,
+        type_id_v<type_id_downcast_t<T1>>, type_id_v<type_id_downcast_t<T2>>,
+        tuple_type_id_v<SD_BUS_TYPE_DICT_ENTRY_END>);
 };
 
 template <typename... Args>
 struct type_id<std::tuple<Args...>>
 {
     static constexpr auto value =
-        std::tuple_cat(tuple_type_id<SD_BUS_TYPE_STRUCT_BEGIN>::value,
-                       type_id<type_id_downcast_t<Args>>::value...,
-                       tuple_type_id<SD_BUS_TYPE_STRUCT_END>::value);
+        std::tuple_cat(tuple_type_id_v<SD_BUS_TYPE_STRUCT_BEGIN>,
+                       type_id_v<type_id_downcast_t<Args>>...,
+                       tuple_type_id_v<SD_BUS_TYPE_STRUCT_END>);
 };
 
 template <typename... Args>
@@ -270,7 +277,7 @@
 {
     static_assert(!std::is_base_of_v<undefined_type_id, type_id<T>>,
                   "No dbus type conversion provided for type.");
-    return type_id<T>::value;
+    return type_id_v<T>;
 }
 
 template <typename T, typename... Args>