diff --git a/include/ozo/type_traits.h b/include/ozo/type_traits.h index 7b4428ec2..59eab2479 100644 --- a/include/ozo/type_traits.h +++ b/include/ozo/type_traits.h @@ -49,11 +49,24 @@ namespace fusion = boost::fusion; */ using oid_t = ::Oid; +/** + * @brief Type for OID constant type definition. + * @ingroup group-type_system + * @tparam `Oid` --- OID value + */ +template +struct oid_constant : std::integral_constant {}; + /** * @brief Type for non initialized OID * @ingroup group-type_system */ -using null_oid_t = std::integral_constant; +using null_oid_t = oid_constant<0>; + +/** + * @brief Constant for empty OID + * @ingroup group-type_system + */ constexpr null_oid_t null_oid; template @@ -257,9 +270,9 @@ inline void reset_nullable(T& n) { #ifdef OZO_DOCUMENTATION template struct type_traits { - using name = ; //!< `boost::hana::string` with name of the type in a database - using oid = ; //!< `std::integral_constant` with Oid of the built-in type or null_oid_t for non built-in type - using size = ; //!< `std::integral_constant` with size of the type object in bytes or `ozo::dynamic_size` in other case + using name = ; //!< `boost::hana::string` with name of the type in a database + using oid = ; //!< `ozo::oid_constant` with Oid of the built-in type or null_oid_t for non built-in type + using size = ; //!< `std::integral_constant` with size of the type object in bytes or `ozo::dynamic_size` in other case }; #else template @@ -285,7 +298,7 @@ struct type_size_match : std::true_type {}; * * @tparam Name --- type which can be converted into a string representation * which contain the fully qualified type name in DB - * @tparam Oid --- oid type - provides type's oid in database, may be defined for + * @tparam Oid --- `ozo::oid_constant`-based oid type - provides type's oid in database, may be defined for * built-in types only; custom types have only dynamic oid, depended * from the current state of DB. * @tparam Size --- size type - provides information about type's object size, may @@ -365,7 +378,7 @@ BOOST_STRONG_TYPEDEF(std::vector, bytea) struct type_traits : type_traits_helper<\ Type, \ OZO__TYPE_NAME_TYPE(Name), \ - std::integral_constant, \ + oid_constant, \ Size\ >{};\ } @@ -376,7 +389,7 @@ BOOST_STRONG_TYPEDEF(std::vector, bytea) struct type_traits> : type_traits_helper<\ std::vector, \ OZO__TYPE_ARRAY_NAME_TYPE(Name), \ - std::integral_constant, \ + oid_constant, \ dynamic_size\ >{};\ }