Skip to content

Commit

Permalink
Properly delete constructors in OptDimsType and DimsType to avoid amb…
Browse files Browse the repository at this point in the history
…iguity
  • Loading branch information
DavidAce committed Nov 24, 2020
1 parent e948625 commit c3b126a
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions h5pp/include/h5pp/details/h5ppDimensionType.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace h5pp {
struct DataInfo;
struct TableInfo;
struct OptDimsType;
class Hyperslab;

struct DimsType {
std::vector<hsize_t> dims;
Expand All @@ -20,10 +21,11 @@ namespace h5pp {
explicit DimsType(std::string) = delete;
explicit DimsType(std::string_view) = delete;
explicit DimsType(const char *) = delete;
explicit DimsType(h5pp::Options) = delete;
explicit DimsType(h5pp::DsetInfo) = delete;
explicit DimsType(h5pp::DataInfo) = delete;
explicit DimsType(h5pp::TableInfo) = delete;
DimsType(h5pp::Options) = delete;
DimsType(h5pp::DsetInfo) = delete;
DimsType(h5pp::DataInfo) = delete;
DimsType(h5pp::TableInfo) = delete;
DimsType(h5pp::Hyperslab) = delete;
DimsType(const std::nullopt_t &) { throw std::runtime_error("nullopt is not a valid dimension for this argument"); }
DimsType(std::initializer_list<hsize_t> &&list) { dims = std::vector<hsize_t>(std::begin(list), std::end(list)); }
template<typename T, typename = std::enable_if_t<std::is_integral_v<T>>>
Expand Down Expand Up @@ -66,10 +68,11 @@ namespace h5pp {
explicit OptDimsType(std::string) = delete;
explicit OptDimsType(std::string_view) = delete;
explicit OptDimsType(const char *) = delete;
explicit OptDimsType(h5pp::Options) = delete;
explicit OptDimsType(h5pp::DsetInfo) = delete;
explicit OptDimsType(h5pp::DataInfo) = delete;
explicit OptDimsType(h5pp::TableInfo) = delete;
OptDimsType(h5pp::Options) = delete;
OptDimsType(h5pp::DsetInfo) = delete;
OptDimsType(h5pp::DataInfo) = delete;
OptDimsType(h5pp::TableInfo) = delete;
OptDimsType(h5pp::Hyperslab) = delete;

OptDimsType(const std::nullopt_t &nullopt) { dims = nullopt; }
OptDimsType(std::initializer_list<hsize_t> &&list) { dims = std::vector<hsize_t>(std::begin(list), std::end(list)); }
Expand Down

0 comments on commit c3b126a

Please sign in to comment.