HighFive icon indicating copy to clipboard operation
HighFive copied to clipboard

Review anonymous file mode enum.

Open 1uc opened this issue 2 years ago • 0 comments

https://github.com/BlueBrain/HighFive/blob/76382329c47c94924eb97a2100a0116494456bee/include/highfive/H5File.hpp#L28-L45

and then here: https://github.com/BlueBrain/HighFive/blob/76382329c47c94924eb97a2100a0116494456bee/include/highfive/H5File.hpp#L54-L56

isn't particularly type safe. One option is:

class File {
  enum class FileMode {
    ReadOnly,
  };

  static constexpr ReadOnly = FileMode::ReadOnly;

  
};

and a lot of boiler plate to allow it to work properly as a bitset. Or use:

using FileMode = std::bitset<?>;

class File {
  static constexpr FileMode ReadOnly = {...};
};

1uc avatar Dec 19 '23 14:12 1uc