Skip to content

Commit 5189fa6

Browse files
committed
DPL: Drop generic code chose between unique and shared pointers
Just use an if constexpr nowadays...
1 parent c8e9b40 commit 5189fa6

File tree

4 files changed

+1
-77
lines changed

4 files changed

+1
-77
lines changed

Framework/Core/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ add_executable(o2-test-framework-core
229229
test/test_OptionsHelpers.cxx
230230
test/test_OverrideLabels.cxx
231231
test/test_O2DataModelHelpers.cxx
232-
test/test_PtrHelpers.cxx
233232
test/test_RootConfigParamHelpers.cxx
234233
test/test_Services.cxx
235234
test/test_StringHelpers.cxx

Framework/Core/include/Framework/TypeTraits.h

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -164,32 +164,5 @@ struct has_root_setowner<
164164
void>> : public std::true_type {
165165
};
166166

167-
/// Helper class to deal with the case we are creating the first instance of a
168-
/// (possibly) shared resource.
169-
///
170-
/// works for both:
171-
///
172-
/// std::shared_ptr<Base> storage = make_matching<decltype(storage), Concrete1>(args...);
173-
///
174-
/// or
175-
///
176-
/// std::unique_ptr<Base> storage = make_matching<decltype(storage), Concrete1>(args...);
177-
///
178-
/// Useful to deal with those who cannot make up their mind about ownership.
179-
/// ;-)
180-
template <typename HOLDER, typename T, typename... ARGS>
181-
static std::enable_if_t<sizeof(std::declval<HOLDER>().unique()) != 0, HOLDER>
182-
make_matching(ARGS&&... args)
183-
{
184-
return std::make_shared<T>(std::forward<ARGS>(args)...);
185-
}
186-
187-
template <typename HOLDER, typename T, typename... ARGS>
188-
static std::enable_if_t<sizeof(std::declval<HOLDER>().get_deleter()) != 0, HOLDER>
189-
make_matching(ARGS&&... args)
190-
{
191-
return std::make_unique<T>(std::forward<ARGS>(args)...);
192-
}
193-
194167
} // namespace o2::framework
195168
#endif // FRAMEWORK_TYPETRAITS_H

Framework/Core/src/runDataProcessing.cxx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,10 +1098,7 @@ int doChild(int argc, char** argv, ServiceRegistry& serviceRegistry,
10981098
serviceRef.registerService(ServiceRegistryHelpers::handleForService<DeviceContext>(deviceContext.get()));
10991099
serviceRef.registerService(ServiceRegistryHelpers::handleForService<DriverConfig const>(&driverConfig));
11001100

1101-
// The decltype stuff is to be able to compile with both new and old
1102-
// FairMQ API (one which uses a shared_ptr, the other one a unique_ptr.
1103-
decltype(r.fDevice) device;
1104-
device = make_matching<decltype(device), DataProcessingDevice>(ref, serviceRegistry, processingPolicies);
1101+
auto device = std::make_unique<DataProcessingDevice>(ref, serviceRegistry, processingPolicies);
11051102

11061103
serviceRef.get<RawDeviceService>().setDevice(device.get());
11071104
r.fDevice = std::move(device);

Framework/Core/test/test_PtrHelpers.cxx

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

0 commit comments

Comments
 (0)