Skip to content

Commit

Permalink
Replace static_assert with std::enable_if (#994)
Browse files Browse the repository at this point in the history
Replace static_assert with std::enable_if for VertexAdaptor
  • Loading branch information
mkornaukhov03 authored May 13, 2024
1 parent 8a04ac2 commit cc78821
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions compiler/data/vertex-adaptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,13 @@ class VertexAdaptor {
explicit VertexAdaptor(vertex_inner<Op> *impl) noexcept
: impl_(impl) {}

template<Operation FromOp>
template<Operation FromOp, typename = std::enable_if_t<op_type_is_base_of(Op, FromOp)>>
VertexAdaptor(const VertexAdaptor<FromOp> &from) noexcept
: impl_(static_cast<vertex_inner<Op> *>(from.impl_)) {
static_assert(op_type_is_base_of(Op, FromOp), "Strange cast to not base vertex");
}

template<Operation FromOp>
template<Operation FromOp, typename = std::enable_if_t<op_type_is_base_of(Op, FromOp)>>
VertexAdaptor<Op> &operator=(const VertexAdaptor<FromOp> &from) noexcept {
static_assert(op_type_is_base_of(Op, FromOp), "Strange assignment to not base vertex");
impl_ = static_cast<vertex_inner<Op> *>(from.impl_);
return *this;
}
Expand Down

0 comments on commit cc78821

Please sign in to comment.