diff --git a/Framework/StackInterface/ParticleBase.h b/Framework/StackInterface/ParticleBase.h index ef85de7af7f61c829e66f04058b89d48706ddc03..d145c1e88610579c8b8ef2ddc219a261b48b695d 100644 --- a/Framework/StackInterface/ParticleBase.h +++ b/Framework/StackInterface/ParticleBase.h @@ -117,13 +117,14 @@ namespace corsika::stack { using T::GetStackData; public: + /* template <typename... Args1, typename... Args2> void SetParticleData(Args1... args1, Args2... args2) { T::SetParticleData(args1...); } - template <typename... Args1, typename... Args2> void SetParticleData(T& p, Args1... args1, Args2... args2) {} + */ }; } // namespace corsika::stack diff --git a/Framework/StackInterface/Stack.h b/Framework/StackInterface/Stack.h index e917f0a721913666da4eea3df37e5c3162c9ec7d..4626ddb9aa3c035270a952f765fba7607d07d5aa 100644 --- a/Framework/StackInterface/Stack.h +++ b/Framework/StackInterface/Stack.h @@ -67,11 +67,17 @@ namespace corsika::stack { delete; ///< since Stack can be very big, we don't want to copy it public: + //Stack() { Init(); } + /** - * if StackDataType is a reference member we *have* to initialize + * if StackDataType is a reference member we *HAVE* to initialize * it in the constructor, this is typically needed for SecondaryView */ - template <typename = std::enable_if_t<std::is_reference<StackDataType>{}>> + template < + typename _StackDataType = StackDataType, + typename = std::enable_if<std::is_same<StackDataType, _StackDataType>::value && + std::is_reference<_StackDataType>::value, + void>> Stack(StackDataType vD) : fData(vD) {} @@ -80,8 +86,11 @@ namespace corsika::stack { * StackDataType user class. If the user did not provide a suited * constructor this will fail with an error message. */ - template <typename... Args, - typename = std::enable_if_t<!std::is_reference<StackDataType>{}>> + template < + typename... Args, typename _StackDataType = StackDataType, + typename = std::enable_if<std::is_same<StackDataType, _StackDataType>::value && + !std::is_reference<_StackDataType>::value, + void >> Stack(Args... args) : fData(args...) {} diff --git a/Framework/StackInterface/testStackInterface.cc b/Framework/StackInterface/testStackInterface.cc index 5d4de9dae7b1cb49e6d4915eb565e2a9bf1c8416..8acfa5abacb5e5908537cc07caef5478be24f523 100644 --- a/Framework/StackInterface/testStackInterface.cc +++ b/Framework/StackInterface/testStackInterface.cc @@ -33,7 +33,6 @@ using namespace corsika::stack; using namespace std; typedef Stack<TestStackData, TestParticleInterface> StackTest; -typedef StackTest::ParticleInterfaceType Particle; TEST_CASE("Stack", "[Stack]") { @@ -48,7 +47,6 @@ TEST_CASE("Stack", "[Stack]") { // construct a valid Stack object StackTest s; - s.Init(); s.Clear(); s.AddParticle(std::tuple{0.}); s.Copy(s.cbegin(), s.begin()); @@ -98,7 +96,7 @@ TEST_CASE("Stack", "[Stack]") { StackTest s; REQUIRE(s.GetSize() == 0); auto iter = s.AddParticle(std::tuple{9.9}); - Particle& p = *iter; // also this is valid to access particle data + StackTest::ParticleInterfaceType& p = *iter; // also this is valid to access particle data REQUIRE(s.GetSize() == 1); p.AddSecondary(std::tuple{4.4}); REQUIRE(s.GetSize() == 2);