diff --git a/include/gauxc/molecule.hpp b/include/gauxc/molecule.hpp index ebff857b..ce9aaa6a 100644 --- a/include/gauxc/molecule.hpp +++ b/include/gauxc/molecule.hpp @@ -16,10 +16,16 @@ namespace GauXC { class Molecule : public std::vector { +private: + /// Tests if the base class can be constructed from @p Args + template + static constexpr auto can_construct_base_v = + std::is_constructible_v, Args...>; public: - template + template >> Molecule( Args&&... args ) : std::vector( std::forward(args)... ) { } diff --git a/tests/ini_input.hpp b/tests/ini_input.hpp index bd0de809..1577f2ee 100644 --- a/tests/ini_input.hpp +++ b/tests/ini_input.hpp @@ -24,7 +24,7 @@ */ static inline std::string& trim_left(std::string &s) { s.erase(s.begin(), std::find_if(s.begin(), s.end(), - std::not1(std::ptr_fun(std::isspace)))); + [](int ch) { return !std::isspace(ch); })); return s; }; // trim_left @@ -36,7 +36,7 @@ static inline std::string& trim_left(std::string &s) { */ static inline std::string& trim_right(std::string &s) { s.erase(std::find_if(s.rbegin(), s.rend(), - std::not1(std::ptr_fun(std::isspace))).base(), s.end()); + [](int ch) { return !std::isspace(ch); }).base(), s.end()); return s; }; // trim_right diff --git a/tests/moltypes_test.cxx b/tests/moltypes_test.cxx index f63dce91..5ed00c55 100644 --- a/tests/moltypes_test.cxx +++ b/tests/moltypes_test.cxx @@ -47,6 +47,13 @@ TEST_CASE("Molecule", "[moltypes]") { size_t natoms_gen = 40; + SECTION("Default") { + + Molecule mol; + + CHECK(mol.natoms() == 0); + } + SECTION("From std::vector") { std::vector atoms; @@ -113,6 +120,25 @@ TEST_CASE("Molecule", "[moltypes]") { } + SECTION("Copy ctor") { + + std::vector atoms{Atom(AtomicNumber(1), 0.0, 0.0, 0.0)}; + Molecule mol(atoms); + + Molecule mol_copy(mol); + CHECK(mol == mol_copy); + } + + + SECTION("Move ctor") { + + std::vector atoms{Atom(AtomicNumber(1), 0.0, 0.0, 0.0)}; + Molecule mol(atoms); + + Molecule mol_copy(mol); + Molecule mol_move(std::move(mol)); + CHECK(mol_move == mol_copy); + } }