Skip to content

Commit

Permalink
cphd::FileHeader::DEFAULT_VERSION has to be const char* for existin…
Browse files Browse the repository at this point in the history
…g Python bindings
  • Loading branch information
Dan Smith committed Jun 19, 2023
1 parent 03ec8e6 commit cfae945
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion six/modules/c++/cphd/include/cphd/FileHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ namespace cphd
class FileHeader final : public BaseFileHeader
{
public:
static const std::string DEFAULT_VERSION;
static const char* DEFAULT_VERSION; // `const char*` for existing Python bindings

/*
* \func FileHeader
Expand Down
8 changes: 7 additions & 1 deletion six/modules/c++/cphd/source/FileHeader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@

namespace cphd
{
const std::string FileHeader::DEFAULT_VERSION = to_string(Version::v101);

static const char* getDefaultVersion()
{
static const auto defaultVersion = to_string(Version::v101);
return defaultVersion.c_str();
}
const char* FileHeader::DEFAULT_VERSION = getDefaultVersion();

FileHeader::FileHeader() :
mVersion(DEFAULT_VERSION),
Expand Down

0 comments on commit cfae945

Please sign in to comment.