Closed mschollmeier closed 3 years ago
I've updated the c++ example 6 to include std library features (e.g., unique_ptr, auto, cout, ...) and added rudimentary error handling. For example:
unique_ptr
auto
cout
/*parser test for Ca(HCO3)2 (calcium bicarbonate)*/ auto cdtest = unique_ptr<compoundData>(CompoundParser("Ca(HCO3)2", &err)); if (cdtest) { cout << "Ca(HCO3)2 contains " << cdtest->nAtomsAll << " atoms, " << cdtest->nElements << " elements and has a molar mass of " << cdtest->molarMass << " g/mol" << endl; for (int i = 0; i < cdtest->nElements; i++) cout << " Element " << cdtest->Elements[i] << ": " << cdtest->massFractions[i] * 100.0 << "% and " << cdtest->nAtoms[i] << " atoms" << endl; } else throw errorstring(__LINE__, *err);
If you're interested I can upload and create a pull request.
Yep that looks cool. Feel free to open a PR.
Thanks!
Closed in #139 and #144
I've updated the c++ example 6 to include std library features (e.g.,
unique_ptr
,auto
,cout
, ...) and added rudimentary error handling. For example:If you're interested I can upload and create a pull request.