Skip to content

Commit 4e80dac

Browse files
committed
ContainerInfo: Create explicit clone method to copy objects
1 parent 7361d8f commit 4e80dac

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

oi/ContainerInfo.h

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,15 @@ struct ContainerInfo {
7171
codegen(std::move(codegen_)) {
7272
}
7373

74-
ContainerInfo(const ContainerInfo&) = delete;
75-
ContainerInfo& operator=(const ContainerInfo& other) = delete;
76-
7774
ContainerInfo(ContainerInfo&&) = default;
7875
ContainerInfo& operator=(ContainerInfo&&) = default;
7976

77+
// Explicit interface for copying
78+
ContainerInfo clone() const {
79+
ContainerInfo copy{*this};
80+
return copy;
81+
}
82+
8083
std::string typeName;
8184
std::regex matcher;
8285
std::optional<size_t> numTemplateParams;
@@ -89,6 +92,7 @@ struct ContainerInfo {
8992
// adapter
9093
std::optional<size_t> underlyingContainerIndex{};
9194
std::vector<size_t> stubTemplateParams{};
95+
bool captureKeys = false;
9296

9397
Codegen codegen;
9498

@@ -98,6 +102,10 @@ struct ContainerInfo {
98102
bool operator<(const ContainerInfo& rhs) const {
99103
return (typeName < rhs.typeName);
100104
}
105+
106+
private:
107+
ContainerInfo(const ContainerInfo&) = default;
108+
ContainerInfo& operator=(const ContainerInfo& other) = default;
101109
};
102110

103111
class ContainerInfoError : public std::runtime_error {

0 commit comments

Comments
 (0)