diff --git a/tiledb/sm/cpp_api/enumeration_experimental.h b/tiledb/sm/cpp_api/enumeration_experimental.h index af4b8aa1bf8..0fac073fedb 100644 --- a/tiledb/sm/cpp_api/enumeration_experimental.h +++ b/tiledb/sm/cpp_api/enumeration_experimental.h @@ -239,17 +239,14 @@ class Enumeration { const std::string& name, std::vector& values, bool ordered = false, - tiledb_datatype_t type = static_cast(255)) { + std::optional type = std::nullopt) { using DataT = impl::TypeHandler; - - if (type == static_cast(255)) { - type = DataT::tiledb_type; - } + tiledb_datatype_t dtype = type.value_or(DataT::tiledb_type); return create( ctx, name, - type, + dtype, DataT::tiledb_num, ordered, values.data(), @@ -275,14 +272,11 @@ class Enumeration { const std::string& name, std::vector>& values, bool ordered = false, - tiledb_datatype_t type = static_cast(255)) { + std::optional type = std::nullopt) { using DataT = impl::TypeHandler; static_assert( DataT::tiledb_num == 1, "Enumeration string values cannot be compound"); - - if (type == static_cast(255)) { - type = DataT::tiledb_type; - } + tiledb_datatype_t dtype = type.value_or(DataT::tiledb_type); uint64_t total_size = 0; for (auto v : values) { @@ -303,7 +297,7 @@ class Enumeration { return create( ctx, name, - type, + dtype, TILEDB_VAR_NUM, ordered, data.data(),