Skip to content

Commit

Permalink
use enable_if in interface constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
m-fila committed Sep 22, 2024
1 parent 3971934 commit 956c6b9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions python/templates/Interface.h.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,9 @@ class {{ class.bare_type }} {
std::unique_ptr<Concept> m_self{nullptr};

public:
template<typename ValueT>
template<typename ValueT, typename = std::enable_if_t<isInitializableFrom<ValueT>>>
{{ class.bare_type }}(ValueT value) :
m_self(std::make_unique<Model<podio::detail::GetDefaultHandleType<ValueT>>>(value)) {
static_assert(isInitializableFrom<ValueT>, "{{ class.bare_type }} can only be initialized with one of the following types (and their Mutable counter parts): {{ Types | join(", ") }}");
}

{{ class.bare_type }}(const {{ class.bare_type }}& other) :
Expand Down

0 comments on commit 956c6b9

Please sign in to comment.