Skip to content

Commit 74c7d61

Browse files
committed
Let DeviceProduct<T> use the constructor T{kUninitialized}
Let DeviceProduct<T> use a special constructor T{kUninitialized} instead of the default constructor T{}, if it is available.
1 parent 4c7f02a commit 74c7d61

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

DataFormats/Common/interface/DeviceProduct.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include <cassert>
55
#include <memory>
66

7+
#include "DataFormats/Common/interface/Uninitialized.h"
8+
79
namespace edm {
810
class DeviceProductBase {
911
public:
@@ -45,7 +47,13 @@ namespace edm {
4547
template <typename T>
4648
class DeviceProduct : public DeviceProductBase {
4749
public:
48-
DeviceProduct() = default;
50+
DeviceProduct()
51+
requires(requires { T(); })
52+
= default;
53+
54+
explicit DeviceProduct(edm::Uninitialized)
55+
requires(requires { T(edm::kUninitialized); })
56+
: data_{edm::kUninitialized} {}
4957

5058
template <typename M, typename... Args>
5159
explicit DeviceProduct(std::shared_ptr<M> metadata, Args&&... args)

0 commit comments

Comments
 (0)