Skip to content

Commit 4e872ff

Browse files
committed
Remove Queue template parameter from breadth_first_search_view
Not includeed in P1709
1 parent 8cbba42 commit 4e872ff

File tree

1 file changed

+38
-37
lines changed

1 file changed

+38
-37
lines changed

include/graph/views/breadth_first_search.hpp

Lines changed: 38 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct bfs_element {
4646
vertex_id_t<G> u_id;
4747
};*/
4848

49-
template <adjacency_list G, class Queue, class Alloc>
49+
template <adjacency_list G, class Alloc>
5050
requires ranges::random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>>
5151
class bfs_base : public ranges::view_base {
5252
public:
@@ -61,6 +61,7 @@ class bfs_base : public ranges::view_base {
6161

6262
private:
6363
using graph_ref_type = reference_wrapper<graph_type>;
64+
using Queue = queue<vertex_id_t<G>>;
6465
//using queue_elem = bfs_element<graph_type>;
6566
using queue_elem = vertex_id_type;
6667

@@ -192,14 +193,13 @@ class bfs_base : public ranges::view_base {
192193
*
193194
* @tparam G Graph type
194195
* @tparam VVF Vertex Value Function type
195-
* @tparam Queue Queue type for internal use
196196
* @tparam Alloc Allocator type
197197
*/
198-
template <adjacency_list G, class VVF = void, class Queue = queue<vertex_id_t<G>>, class Alloc = allocator<bool>>
198+
template <adjacency_list G, class VVF = void, class Alloc = allocator<bool>>
199199
requires ranges::random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>>
200-
class vertices_breadth_first_search_view : public bfs_base<G, Queue, Alloc> {
200+
class vertices_breadth_first_search_view : public bfs_base<G, Alloc> {
201201
public:
202-
using base_type = bfs_base<G, Queue, Alloc>;
202+
using base_type = bfs_base<G, Alloc>;
203203
using graph_type = G;
204204
using vertex_type = vertex_t<G>;
205205
using vertex_id_type = vertex_id_t<graph_type>;
@@ -208,7 +208,7 @@ class vertices_breadth_first_search_view : public bfs_base<G, Queue, Alloc> {
208208
using edge_type = edge_t<G>;
209209
using edge_reference = edge_reference_t<G>;
210210
using edge_iterator = vertex_edge_iterator_t<graph_type>;
211-
using bfs_range_type = vertices_breadth_first_search_view<graph_type, VVF, Queue, Alloc>;
211+
using bfs_range_type = vertices_breadth_first_search_view<graph_type, VVF, Alloc>;
212212

213213
using vertex_value_func = VVF;
214214
using vertex_value_type = invoke_result_t<VVF, vertex_reference>;
@@ -323,11 +323,11 @@ class vertices_breadth_first_search_view : public bfs_base<G, Queue, Alloc> {
323323
};
324324

325325

326-
template <adjacency_list G, class Queue, class Alloc>
326+
template <adjacency_list G, class Alloc>
327327
requires ranges::random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>>
328-
class vertices_breadth_first_search_view<G, void, Queue, Alloc> : public bfs_base<G, Queue, Alloc> {
328+
class vertices_breadth_first_search_view<G, void, Alloc> : public bfs_base<G, Alloc> {
329329
public:
330-
using base_type = bfs_base<G, Queue, Alloc>;
330+
using base_type = bfs_base<G, Alloc>;
331331
using graph_type = G;
332332
using vertex_type = vertex_t<G>;
333333
using vertex_id_type = vertex_id_t<graph_type>;
@@ -336,7 +336,7 @@ class vertices_breadth_first_search_view<G, void, Queue, Alloc> : public bfs_bas
336336
using edge_type = edge_t<G>;
337337
using edge_reference = edge_reference_t<G>;
338338
using edge_iterator = vertex_edge_iterator_t<graph_type>;
339-
using bfs_range_type = vertices_breadth_first_search_view<graph_type, void, Queue, Alloc>;
339+
using bfs_range_type = vertices_breadth_first_search_view<graph_type, void, Alloc>;
340340

341341
public:
342342
vertices_breadth_first_search_view(graph_type& g, vertex_id_type seed, const Alloc& alloc = Alloc())
@@ -443,23 +443,18 @@ class vertices_breadth_first_search_view<G, void, Queue, Alloc> : public bfs_bas
443443
* @tparam G Graph type
444444
* @tparam EVF Edge Value Function type
445445
* @tparam Sourced Does the graph support @c source_id()?
446-
* @tparam Queue Queue type for internal use
447446
* @tparam Alloc Allocator type
448447
*/
449-
template <adjacency_list G,
450-
class EVF = void,
451-
bool Sourced = false,
452-
class Queue = queue<vertex_id_t<G>>,
453-
class Alloc = allocator<bool>>
448+
template <adjacency_list G, class EVF = void, bool Sourced = false, class Alloc = allocator<bool>>
454449
requires ranges::random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>>
455-
class edges_breadth_first_search_view : public bfs_base<G, Queue, Alloc> {
450+
class edges_breadth_first_search_view : public bfs_base<G, Alloc> {
456451
public:
457-
using base_type = bfs_base<G, Queue, Alloc>;
452+
using base_type = bfs_base<G, Alloc>;
458453
using graph_type = G;
459454
using vertex_id_type = vertex_id_t<graph_type>;
460455
using vertex_iterator = vertex_iterator_t<graph_type>;
461456
using edge_reference_type = edge_reference_t<graph_type>;
462-
using bfs_range_type = edges_breadth_first_search_view<G, EVF, Sourced, Queue, Alloc>;
457+
using bfs_range_type = edges_breadth_first_search_view<G, EVF, Sourced, Alloc>;
463458

464459
using edge_value_func = EVF;
465460
using edge_value_type = invoke_result_t<EVF, edge_reference_type>;
@@ -568,16 +563,16 @@ class edges_breadth_first_search_view : public bfs_base<G, Queue, Alloc> {
568563
const EVF* value_fn_ = nullptr;
569564
};
570565

571-
template <adjacency_list G, bool Sourced, class Queue, class Alloc>
566+
template <adjacency_list G, bool Sourced, class Alloc>
572567
requires ranges::random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>>
573-
class edges_breadth_first_search_view<G, void, Sourced, Queue, Alloc> : public bfs_base<G, Queue, Alloc> {
568+
class edges_breadth_first_search_view<G, void, Sourced, Alloc> : public bfs_base<G, Alloc> {
574569
public:
575-
using base_type = bfs_base<G, Queue, Alloc>;
570+
using base_type = bfs_base<G, Alloc>;
576571
using graph_type = G;
577572
using vertex_id_type = vertex_id_t<graph_type>;
578573
using vertex_iterator = vertex_iterator_t<graph_type>;
579574
using edge_reference_type = edge_reference_t<graph_type>;
580-
using bfs_range_type = edges_breadth_first_search_view<G, void, Sourced, Queue, Alloc>;
575+
using bfs_range_type = edges_breadth_first_search_view<G, void, Sourced, Alloc>;
581576

582577
public:
583578
edges_breadth_first_search_view(G& g, vertex_id_type seed, const Alloc& alloc = Alloc())
@@ -678,6 +673,12 @@ class edges_breadth_first_search_view<G, void, Sourced, Queue, Alloc> : public b
678673
};
679674
} // namespace std::graph
680675

676+
677+
# if 0
678+
679+
namespace std::graph::views {}
680+
# else
681+
681682
namespace std::graph::tag_invoke {
682683
// vertices_breadth_first_search CPO
683684
TAG_INVOKE_DEF(vertices_breadth_first_search); // vertices_breadth_first_search(g,seed) -> vertices[vid,v]
@@ -727,74 +728,74 @@ namespace std::graph::views {
727728
// vertices_breadth_first_search(g,uid)
728729
// vertices_breadth_first_search(g,uid,vvf)
729730
//
730-
template <adjacency_list G, class Queue = queue<vertex_id_t<G>>, class Alloc = allocator<bool>>
731+
template <adjacency_list G, class Alloc = allocator<bool>>
731732
requires ranges::random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>> && _detail::is_allocator_v<Alloc>
732733
constexpr auto vertices_breadth_first_search(G&& g, vertex_id_t<G> seed, const Alloc& alloc = Alloc()) {
733734
if constexpr (tag_invoke::_has_vtx_bfs_adl<G, Alloc>)
734735
return tag_invoke::vertices_breadth_first_search(g, seed, alloc);
735736
else
736-
return vertices_breadth_first_search_view<G, void, Queue>(g, seed, alloc);
737+
return vertices_breadth_first_search_view<G, void>(g, seed, alloc);
737738
}
738739

739-
template <adjacency_list G, class VVF, class Queue = queue<vertex_id_t<G>>, class Alloc = allocator<bool>>
740+
template <adjacency_list G, class VVF, class Alloc = allocator<bool>>
740741
requires ranges::random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>> &&
741742
is_invocable_v<VVF, vertex_reference_t<G>> && _detail::is_allocator_v<Alloc>
742743
constexpr auto vertices_breadth_first_search(G&& g, vertex_id_t<G> seed, const VVF& vvf, const Alloc& alloc = Alloc()) {
743744
if constexpr (tag_invoke::_has_vtx_bfs_vvf_adl<G, VVF, Alloc>)
744745
return tag_invoke::vertices_breadth_first_search(g, seed, vvf, alloc);
745746
else
746-
return vertices_breadth_first_search_view<G, VVF, Queue>(g, seed, vvf, alloc);
747+
return vertices_breadth_first_search_view<G, VVF>(g, seed, vvf, alloc);
747748
}
748749

749750
//
750751
// edges_breadth_first_search(g,uid)
751752
// edges_breadth_first_search(g,uid,evf)
752753
//
753-
template <adjacency_list G, class Queue = queue<vertex_id_t<G>>, class Alloc = allocator<bool>>
754+
template <adjacency_list G, class Alloc = allocator<bool>>
754755
requires ranges::random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>> && _detail::is_allocator_v<Alloc>
755756
constexpr auto edges_breadth_first_search(G&& g, vertex_id_t<G> seed, const Alloc& alloc = Alloc()) {
756757
if constexpr (tag_invoke::_has_edg_bfs_adl<G, Alloc>)
757758
return tag_invoke::edges_breadth_first_search(g, seed, alloc);
758759
else
759-
return edges_breadth_first_search_view<G, void, false, Queue>(g, seed, alloc);
760+
return edges_breadth_first_search_view<G, void, false>(g, seed, alloc);
760761
}
761762

762-
template <adjacency_list G, class EVF, class Queue = queue<vertex_id_t<G>>, class Alloc = allocator<bool>>
763+
template <adjacency_list G, class EVF, class Alloc = allocator<bool>>
763764
requires ranges::random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>> &&
764765
is_invocable_v<EVF, edge_reference_t<G>> && _detail::is_allocator_v<Alloc>
765766
constexpr auto edges_breadth_first_search(G&& g, vertex_id_t<G> seed, const EVF& evf, const Alloc& alloc = Alloc()) {
766767
if constexpr (tag_invoke::_has_edg_bfs_evf_adl<G, EVF, Alloc>)
767768
return tag_invoke::edges_breadth_first_search(g, seed, evf, alloc);
768769
else
769-
return edges_breadth_first_search_view<G, EVF, false, Queue>(g, seed, evf, alloc);
770+
return edges_breadth_first_search_view<G, EVF, false>(g, seed, evf, alloc);
770771
}
771772

772773
//
773774
// sourced_edges_breadth_first_search(g,uid)
774775
// sourced_edges_breadth_first_search(g,uid,evf)
775776
//
776-
template <adjacency_list G, class Queue = queue<vertex_id_t<G>>, class Alloc = allocator<bool>>
777+
template <adjacency_list G, class Alloc = allocator<bool>>
777778
requires ranges::random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>> && _detail::is_allocator_v<Alloc>
778779
constexpr auto sourced_edges_breadth_first_search(G&& g, vertex_id_t<G> seed, const Alloc& alloc = Alloc()) {
779780
if constexpr (tag_invoke::_has_src_edg_bfs_adl<G, Alloc>)
780781
return tag_invoke::sourced_edges_breadth_first_search(g, seed, alloc);
781782
else
782-
return edges_breadth_first_search_view<G, void, true, Queue>(g, seed, alloc);
783+
return edges_breadth_first_search_view<G, void, true>(g, seed, alloc);
783784
}
784785

785-
template <adjacency_list G, class EVF, class Queue = queue<vertex_id_t<G>>, class Alloc = allocator<bool>>
786+
template <adjacency_list G, class EVF, class Alloc = allocator<bool>>
786787
requires ranges::random_access_range<vertex_range_t<G>> && integral<vertex_id_t<G>> &&
787788
is_invocable_v<EVF, edge_reference_t<G>> && _detail::is_allocator_v<Alloc>
788789
constexpr auto
789790
sourced_edges_breadth_first_search(G&& g, vertex_id_t<G> seed, const EVF& evf, const Alloc& alloc = Alloc()) {
790791
if constexpr (tag_invoke::_has_src_edg_bfs_evf_adl<G, EVF, Alloc>)
791792
return tag_invoke::sourced_edges_breadth_first_search(g, seed, evf, alloc);
792793
else
793-
return edges_breadth_first_search_view<G, EVF, true, Queue>(g, seed, evf, alloc);
794+
return edges_breadth_first_search_view<G, EVF, true>(g, seed, evf, alloc);
794795
}
795796

796797

797798
} // namespace std::graph::views
799+
# endif //1
798800

799-
800-
#endif // GRAPH_BFS_HPP
801+
#endif // GRAPH_BFS_HPP

0 commit comments

Comments
 (0)