diff --git a/tree/treeplayer/test/data.h b/tree/treeplayer/test/data.h index f6dafdd8a3f97..cb22066e6d264 100644 --- a/tree/treeplayer/test/data.h +++ b/tree/treeplayer/test/data.h @@ -3,13 +3,26 @@ #include struct Data { - unsigned int fUSize; - int fSize; - double* fArray; //[fSize] - float* fUArray; //[fUSize] - std::vector fVec; - Double32_t fDouble32; - Float16_t fFloat16; + unsigned int fUSize{2}; + int fSize{4}; + double *fArray; //[fSize] + float *fUArray; //[fUSize] + std::vector fVec{17., 18., 19., 20., 21., 22.}; + Double32_t fDouble32{17.}; + Float16_t fFloat16{44.}; + + Data() : fArray(new double[4]{12., 13., 14., 15.}), fUArray(new float[2]{42., 43.}) {} + Data(const Data &) = delete; + Data &operator=(const Data &) = delete; + Data(Data &&) = delete; + Data &operator=(Data &&) = delete; + ~Data() + { + delete[] fArray; + fArray = nullptr; + delete[] fUArray; + fUArray = nullptr; + } }; struct V { diff --git a/tree/treeplayer/test/leafs.cxx b/tree/treeplayer/test/leafs.cxx index 69ed3fc3d4447..413054932e8d4 100644 --- a/tree/treeplayer/test/leafs.cxx +++ b/tree/treeplayer/test/leafs.cxx @@ -95,13 +95,6 @@ std::unique_ptr CreateTree() { Data data; auto tree = std::make_unique("T", "test tree"); tree->Branch("Data", &data); - data.fArray = new double[4]{12., 13., 14., 15.}; - data.fSize = 4; - data.fUArray = new float[2]{42., 43.}; - data.fUSize = 2; - data.fVec = { 17., 18., 19., 20., 21., 22.}; - data.fDouble32 = 17.; - data.fFloat16 = 44.; tree->Fill(); data.fVec.clear();