diff --git a/include/momo/DataTable.h b/include/momo/DataTable.h index 853d80a5..8db0632f 100644 --- a/include/momo/DataTable.h +++ b/include/momo/DataTable.h @@ -508,13 +508,13 @@ class DataTable return pvNewRow(assign, assigns...); } - template - Row NewRow(RawArg&& rawArg) - requires requires (ColumnList& columnList, MemManager& memManager, Raw* raw) - { columnList.CreateRaw(memManager, std::forward(rawArg), raw); } + Row NewRow(std::conditional_t, void*, Raw>&& srcRaw) //? + requires (!std::is_void_v) && + requires (ColumnList& columnList, MemManager& memManager, Raw* raw) + { columnList.CreateRaw(memManager, std::move(srcRaw), raw); } { - auto rawCreator = [this, &rawArg] (Raw* raw) - { GetColumnList().CreateRaw(GetMemManager(), std::forward(rawArg), raw); }; + auto rawCreator = [this, &srcRaw] (Raw* raw) + { GetColumnList().CreateRaw(GetMemManager(), std::move(srcRaw), raw); }; return pvMakeRow(pvCreateRaw(FastMovableFunctor(std::move(rawCreator)))); } diff --git a/test/sources/SimpleDataSampler.cpp b/test/sources/SimpleDataSampler.cpp index f7ecfad5..d532beb1 100644 --- a/test/sources/SimpleDataSampler.cpp +++ b/test/sources/SimpleDataSampler.cpp @@ -93,7 +93,7 @@ namespace sample_data2 // unique index (primary key) table.AddUniqueHashIndex(&Struct::strCol, &Struct::intCol); - table.AddRow(table.NewRow(Struct{ .intCol = 1, .dblCol = 0.5, .strCol = "b" })); + table.AddRow(table.NewRow({ .intCol = 1, .dblCol = 0.5, .strCol = "b" })); { auto row = table.NewRow(); @@ -102,7 +102,7 @@ namespace sample_data2 table.TryAddRow(std::move(row)); // strCol = "" } - table.TryAddRow(table.NewRow(Struct{ .intCol = 1, .dblCol = 3.5, .strCol = "b" })); + table.TryAddRow(table.NewRow({ .intCol = 1, .dblCol = 3.5, .strCol = "b" })); // not added because of unique index output << table.GetCount() << std::endl; // 2 @@ -282,8 +282,8 @@ namespace sample_data5 // construct empty table with 3 columns Table table; - table.AddRow(table.NewRow(Struct{ .intCol = 1, .dblCol = 1.5, .strCol = "a" })); - table.AddRow(table.NewRow(Struct{ .intCol = 2, .strCol = "a" })); + table.AddRow(table.NewRow({ .intCol = 1, .dblCol = 1.5, .strCol = "a" })); + table.AddRow(table.NewRow({ .intCol = 2, .strCol = "a" })); for (auto row : table) output << row->intCol << " " << row->dblCol << " " << row->strCol << std::endl; diff --git a/test/sources/SimpleDataTester.cpp b/test/sources/SimpleDataTester.cpp index 52fd6049..85b347af 100644 --- a/test/sources/SimpleDataTester.cpp +++ b/test/sources/SimpleDataTester.cpp @@ -503,7 +503,7 @@ class SimpleDataTester if constexpr (!dynamic) { - Row row = table.NewRow(Struct{ .intStruct = 1, .dblStruct = 3.5, .strStruct = "2" }); + Row row = table.NewRow({ .intStruct = 1, .dblStruct = 3.5, .strStruct = "2" }); assert(row->intStruct == 1); assert(row->dblStruct == 3.5); assert(row->strStruct == "2");