Skip to content

Commit e37b77e

Browse files
authored
Merge a31c179 into 68c8f3f
2 parents 68c8f3f + a31c179 commit e37b77e

File tree

3 files changed

+12
-59
lines changed

3 files changed

+12
-59
lines changed

ydb/core/tablet_flat/flat_cxx_database.h

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
#include <ydb/core/tablet_flat/flat_database.h>
44
#include <ydb/core/util/tuples.h>
5-
#include <ydb/core/util/templates.h>
65
#include <ydb/core/base/blobstorage_common.h>
76

87
#include <util/system/type_name.h>
98
#include <util/system/unaligned_mem.h>
109
#include <library/cpp/containers/stack_vector/stack_vec.h>
10+
#include <type_traits>
1111
#include <utility>
1212

1313
// https://wiki.yandex-team.ru/kikimr/techdoc/db/cxxapi/nicedb/
@@ -1437,7 +1437,7 @@ struct Schema {
14371437
}
14381438

14391439
template <typename ColumnType>
1440-
auto GetValueOrDefault(typename ColumnType::Type defaultValue = GetDefaultValue<ColumnType>(SFINAE::special())) const {
1440+
auto GetValueOrDefault(typename ColumnType::Type defaultValue = GetDefaultValue<ColumnType>()) const {
14411441
Y_DEBUG_ABORT_UNLESS(IsReady(), "Rowset is not ready");
14421442
Y_DEBUG_ABORT_UNLESS(IsValid(), "Rowset is not valid");
14431443
typename ColumnType::Type value(HaveValue<ColumnType>() ? GetColumnValue<ColumnType>() : defaultValue);
@@ -1462,24 +1462,19 @@ struct Schema {
14621462
return DbgPrintTuple(Iterator.GetKey(), typeRegistry) + " -> " + DbgPrintTuple(Iterator.GetValues(), typeRegistry);
14631463
}
14641464

1465-
template <typename ColumnType, typename SFINAE::type_check<decltype(ColumnType::Default)>::type = 0>
1466-
static decltype(ColumnType::Default) GetNullValue(SFINAE::special) {
1467-
return ColumnType::Default;
1468-
}
1469-
14701465
template <typename ColumnType>
1471-
static typename ColumnType::Type GetNullValue(SFINAE::general) {
1472-
return typename ColumnType::Type();
1473-
}
1474-
1475-
template <typename ColumnType, typename SFINAE::type_check<decltype(ColumnType::Default)>::type = 0>
1476-
static decltype(ColumnType::Default) GetDefaultValue(SFINAE::special) {
1477-
return ColumnType::Default;
1466+
static typename ColumnType::Type GetNullValue() {
1467+
return GetDefaultValue<ColumnType>();
14781468
}
14791469

14801470
template <typename ColumnType>
1481-
static typename ColumnType::Type GetDefaultValue(SFINAE::general) {
1482-
return typename ColumnType::Type();
1471+
static typename ColumnType::Type GetDefaultValue() {
1472+
constexpr bool hasDefault = requires {ColumnType::Default;};
1473+
if constexpr (hasDefault) {
1474+
return ColumnType::Default;
1475+
} else {
1476+
return typename ColumnType::Type();
1477+
}
14831478
}
14841479

14851480
NTable::TIteratorStats* Stats() const {
@@ -1499,7 +1494,7 @@ struct Schema {
14991494
auto& cell = tuple.Columns[index];
15001495
auto type = tuple.Types[index];
15011496
if (cell.IsNull())
1502-
return GetNullValue<ColumnType>(SFINAE::special());
1497+
return GetNullValue<ColumnType>();
15031498
return TConvert<ColumnType, typename ColumnType::Type>::Convert(TRawTypeValue(cell.Data(), cell.Size(), type));
15041499
}
15051500

ydb/core/util/templates.h

Lines changed: 0 additions & 41 deletions
This file was deleted.

ydb/core/util/ya.make

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ SRCS(
4646
single_thread_ic_mock.h
4747
stlog.cpp
4848
stlog.h
49-
templates.h
5049
testactorsys.cpp
5150
testactorsys.h
5251
text.cpp

0 commit comments

Comments
 (0)