File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -287,7 +287,7 @@ class basic_flow {
287287 * @param last An iterator past the last element of the range of elements.
288288 * @return This flow builder.
289289 */
290- basic_flow &ro (stl::input_iterator auto first, stl::input_iterator auto last) {
290+ basic_flow &ro (stl::input_iterator auto first, stl::sentinel_for< decltype (first)> auto last) {
291291 static_assert (stl::is_convertible_v<decltype (*first), id_type>, " Unexpected value type" );
292292
293293 for (; first != last; ++first) {
@@ -313,7 +313,7 @@ class basic_flow {
313313 * @param last An iterator past the last element of the range of elements.
314314 * @return This flow builder.
315315 */
316- basic_flow &rw (stl::input_iterator auto first, stl::input_iterator auto last) {
316+ basic_flow &rw (stl::input_iterator auto first, stl::sentinel_for< decltype (first)> auto last) {
317317 static_assert (stl::is_convertible_v<decltype (*first), id_type>, " Unexpected value type" );
318318
319319 for (; first != last; ++first) {
Original file line number Diff line number Diff line change @@ -194,6 +194,20 @@ TEST(Flow, RangeRW) {
194194 ASSERT_FALSE (graph.contains (1u , 0u ));
195195}
196196
197+ TEST (Flow, RangeWithSentinel) {
198+ const std::array<entt::id_type, 3u > res{0u , 1u };
199+ entt::flow flow{};
200+
201+ flow.bind (0u ).rw (std::counted_iterator{res.begin (), 1 }, std::default_sentinel);
202+ flow.bind (1u ).ro (std::counted_iterator{res.begin (), 2 }, std::default_sentinel);
203+
204+ const auto graph = flow.graph ();
205+
206+ ASSERT_EQ (graph.size (), 2u );
207+ ASSERT_TRUE (graph.contains (0u , 1u ));
208+ ASSERT_FALSE (graph.contains (1u , 0u ));
209+ }
210+
197211TEST (Flow, Graph) {
198212 using namespace entt ::literals;
199213
You can’t perform that action at this time.
0 commit comments