Skip to content

Commit

Permalink
use structured binding instead of std::tie
Browse files Browse the repository at this point in the history
To make sure vertices can be some class that is not default
constructable.
  • Loading branch information
arashbm committed Nov 19, 2023
1 parent c208666 commit 88f8eb7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/static_edges.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ namespace reticula {

template <network_vertex VertexType>
undirected_edge<VertexType>::undirected_edge(VertexType v1, VertexType v2) {
std::tie(_v1, _v2) = std::minmax(v1, v2);
auto [i, j] = std::minmax(v1, v2);
_v1 = i;
_v2 = j;
}

template <network_vertex VertexType>
Expand Down
4 changes: 3 additions & 1 deletion src/temporal_edges.tpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,9 @@ namespace reticula {
template <network_vertex VertexType, typename TimeType>
undirected_temporal_edge<VertexType, TimeType>::undirected_temporal_edge(
VertexType v1, VertexType v2, TimeType time) : _time(time) {
std::tie(_v1, _v2) = std::minmax(v1, v2);
auto [i, j] = std::minmax(v1, v2);
_v1 = i;
_v2 = j;
}

template <network_vertex VertexType, typename TimeType>
Expand Down

0 comments on commit 88f8eb7

Please sign in to comment.