Skip to content

Commit 7b74053

Browse files
authored
Merge pull request #620 from elbeno/warning-sweep
🎨 Improve span for flow construction
2 parents ac1d8ec + 67e4fc4 commit 7b74053

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

include/flow/graph_builder.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <stdx/cx_multimap.hpp>
1010
#include <stdx/cx_set.hpp>
1111
#include <stdx/cx_vector.hpp>
12+
#include <stdx/span.hpp>
1213
#include <stdx/tuple_algorithms.hpp>
1314
#include <stdx/type_traits.hpp>
1415
#include <stdx/utility.hpp>
@@ -20,7 +21,6 @@
2021
#include <cstddef>
2122
#include <iterator>
2223
#include <optional>
23-
#include <span>
2424
#include <utility>
2525

2626
namespace flow {
@@ -186,9 +186,9 @@ struct graph_builder {
186186
if (not g.empty()) {
187187
return {};
188188
}
189-
return std::optional<Output>{
190-
std::in_place,
191-
std::span{std::cbegin(ordered_list), std::size(ordered_list)}};
189+
using span_t =
190+
stdx::span<typename Graph::key_type const, Graph::capacity()>;
191+
return std::optional<Output>{std::in_place, span_t{ordered_list}};
192192
}
193193

194194
constexpr static void check_for_missing_nodes(auto nodes,

include/flow/impl.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
#include <log/log.hpp>
66

77
#include <stdx/cx_vector.hpp>
8+
#include <stdx/span.hpp>
89

910
#include <algorithm>
1011
#include <cstddef>
1112
#include <iterator>
12-
#include <span>
1313
#include <type_traits>
1414

1515
namespace flow {
@@ -60,8 +60,8 @@ template <stdx::ct_string Name, std::size_t NumSteps> class impl {
6060
*
6161
* @see flow::builder
6262
*/
63-
constexpr explicit(true) impl(std::span<node_t const> newMilestones) {
64-
CIB_ASSERT(NumSteps >= std::size(newMilestones));
63+
constexpr explicit(true)
64+
impl(stdx::span<node_t const, NumSteps> newMilestones) {
6565
if constexpr (loggingEnabled) {
6666
for (auto const &milestone : newMilestones) {
6767
functionPtrs.push_back(milestone.log_name);

include/seq/impl.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#pragma once
22

3-
#include <log/log.hpp>
43
#include <seq/step.hpp>
54

65
#include <stdx/ct_string.hpp>
76
#include <stdx/cx_vector.hpp>
7+
#include <stdx/span.hpp>
88

99
#include <array>
1010
#include <cstddef>
1111
#include <iterator>
12-
#include <span>
1312

1413
namespace seq {
1514
enum struct direction { FORWARD = 0, BACKWARD = 1 };
@@ -24,8 +23,7 @@ template <stdx::ct_string, std::size_t NumSteps> struct impl {
2423

2524
using node_t = rt_step;
2625

27-
constexpr explicit(true) impl(std::span<node_t const> steps) {
28-
CIB_ASSERT(NumSteps >= std::size(steps));
26+
constexpr explicit(true) impl(stdx::span<node_t const, NumSteps> steps) {
2927
for (auto const &step : steps) {
3028
_forward_steps.push_back(step.forward_ptr);
3129
_backward_steps.push_back(step.backward_ptr);

0 commit comments

Comments
 (0)