Files
CoolProp/dev/Tickets/1352.cpp
Ian Bell bc8c1bc039 C++17 modernization: remove shims, stdlib idioms, attributes, filesystem (#2688)
* chore: C++17 modernization — remove shims, use stdlib idioms

Phase 1 — Mechanical:
- Replace crossplatform_shared_ptr.h with <memory> in all 20 files; delete shim
- Replace NULL with nullptr (~10 occurrences)
- Replace throw() with noexcept (DataStructures.h)
- Convert 30+ iterator for-loops to range-for with auto/structured bindings
- Replace insert(make_pair/pair<>) with emplace/try_emplace (~40 sites)
- Replace shared_ptr<T>(new T) with make_shared<T> (~5 sites)

Phase 2 — Optional/structured bindings:
- get_alternate() returns std::optional<pair<size_t,size_t>>; remove has_valid_neighbor()
- get_set_of_tables() eliminates bool out-param, returns std::pair
- is_inside() switch refactored to IIFE eliminating nullptr-init pattern

Phase 3 — Attributes:
- Remove DEPRECATED macro; use [[deprecated("...")]] directly (PolyMath.h)
- Add [[nodiscard]] to is_inside, valid, calc_saturated_*_keyed_output,
  get_parameter_information/index, generate_update_pair, has_number

Phase 4 — Architectural:
- CPfilepaths.cpp: use std::filesystem on non-Android/Emscripten/powerpc targets
- DataStructures.h: annotate 5 public enums with explicit underlying type (: int)
- get_parameter_information() takes std::string_view for info param

Build: clean, zero errors. Test suite: 100/110 pass (10 known pre-existing failures).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Remove Unicode replacement character (U+FFFD) from 870.cpp

Addresses PR review comment about non-printing character on line 25.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Remove unnecessary <memory> include from IdealCurves.h

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Always use std::filesystem

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-04 13:28:11 -04:00

30 lines
1.0 KiB
C++

#include <memory>
#include <AbstractState.h>
#include <CoolProp.h>
int main(int argc, const char* argv[]) {
shared_ptr<CoolProp::AbstractState> pState;
pState.reset(CoolProp::AbstractState::factory("HEOS", "Water"));
double T_test = 25 + 273.15;
pState->update(CoolProp::QT_INPUTS, 0.3, T_test);
double rho_test = pState->rhomass();
double s_test = pState->smass();
double drho_new = 0;
pState->specify_phase(CoolProp::iphase_not_imposed);
pState->update(CoolProp::SmassT_INPUTS, s_test, T_test);
drho_new = pState->rhomass() - rho_test;
pState->specify_phase(CoolProp::iphase_not_imposed);
pState->update(CoolProp::DmassT_INPUTS, rho_test, T_test);
drho_new = pState->rhomass() - rho_test;
pState->specify_phase(CoolProp::iphase_twophase);
pState->update(CoolProp::SmassT_INPUTS, s_test, T_test);
drho_new = pState->rhomass() - rho_test;
pState->specify_phase(CoolProp::iphase_twophase);
pState->update(CoolProp::DmassT_INPUTS, rho_test, T_test);
drho_new = pState->rhomass() - rho_test;
}