-
Notifications
You must be signed in to change notification settings - Fork 53
Closed
Description
The following code throw a NcBadId
exception at the auto attr = wrap.file.getAtt("Conventions");
line.
#include <string>
#include <netcdf>
using namespace std;
using namespace netCDF;
class Wrapper {
public:
Wrapper(string name, string mode) {
if (mode == "r")
file = NcFile(name, NcFile::read);
else if (mode == "w")
file = NcFile(name, NcFile::write);
}
NcFile file;
};
int main(int argc, char** argv) {
Wrapper wrap("file.nc", "r");
auto attr = wrap.file.getAtt("Conventions");
return 0;
}
While when I use direct initialisation for the file
member, everything works.
class Wrapper {
public:
Wrapper(string name, string mode) : file(name, NcFile::read) {}
NcFile file;
};
Maybe the library is using the default generated operator=(const NcFile&)
, and this one is not correct. My compiler is clang based on LLVM 3.5.
Metadata
Metadata
Assignees
Labels
No labels