ContainerInfo: Create explicit clone method to copy objects

This commit is contained in:
Alastair Robertson 2023-09-22 06:20:00 -07:00 committed by Alastair Robertson
parent 7361d8fa29
commit 4e80dace1a

View File

@ -71,12 +71,15 @@ struct ContainerInfo {
codegen(std::move(codegen_)) {
}
ContainerInfo(const ContainerInfo&) = delete;
ContainerInfo& operator=(const ContainerInfo& other) = delete;
ContainerInfo(ContainerInfo&&) = default;
ContainerInfo& operator=(ContainerInfo&&) = default;
// Explicit interface for copying
ContainerInfo clone() const {
ContainerInfo copy{*this};
return copy;
}
std::string typeName;
std::regex matcher;
std::optional<size_t> numTemplateParams;
@ -89,6 +92,7 @@ struct ContainerInfo {
// adapter
std::optional<size_t> underlyingContainerIndex{};
std::vector<size_t> stubTemplateParams{};
bool captureKeys = false;
Codegen codegen;
@ -98,6 +102,10 @@ struct ContainerInfo {
bool operator<(const ContainerInfo& rhs) const {
return (typeName < rhs.typeName);
}
private:
ContainerInfo(const ContainerInfo&) = default;
ContainerInfo& operator=(const ContainerInfo& other) = default;
};
class ContainerInfoError : public std::runtime_error {