Fixed bug when generating identical fanouts

This commit is contained in:
2026-05-09 08:36:51 +02:00
parent 2bca2a7554
commit 9ce581b5ce
5 changed files with 366 additions and 11 deletions
+4 -5
View File
@@ -116,7 +116,7 @@ struct FanoutPlaceholder {
namespace kpn {
// Forward declaration — FanoutNode is defined in fanout.hpp.
template<typename T, std::size_t N> class FanoutNode;
template<typename T, std::size_t N, std::size_t Id> class FanoutNode;
} // namespace kpn
namespace kpn::tmp {
@@ -172,7 +172,7 @@ template<std::size_t FanoutId, typename T, std::size_t N,
typename DstNodeT, std::size_t DstI, typename... DstTail, std::size_t I>
struct fanout_to_dst_edges<FanoutId, T, N,
TypeList<DstDesc<DstNodeT, DstI>, DstTail...>, I> {
using head_edge = SimpleEdge<kpn::FanoutNode<T, N>, I, DstNodeT, DstI>;
using head_edge = SimpleEdge<kpn::FanoutNode<T, N, FanoutId>, I, DstNodeT, DstI>;
using rest = typename fanout_to_dst_edges<FanoutId, T, N,
TypeList<DstTail...>, I+1>::type;
using type = append_t<rest, head_edge>;
@@ -282,7 +282,7 @@ struct process_edge {
using DstDescs = typename collect_dsts<Port, AllEdges>::type;
static constexpr std::size_t fid = State::next_id;
using fanout_type = FanoutPlaceholder<T, N, fid>;
using src_to_fan = SimpleEdge<SrcNode, Edge::src_idx, FanoutNode<T, N>, 0>;
using src_to_fan = SimpleEdge<SrcNode, Edge::src_idx, FanoutNode<T, N, fid>, 0>;
using fan_to_dsts = typename fanout_to_dst_edges<fid, T, N, DstDescs>::type;
using fanout_edges = concat_t<append_t<typename State::edges, src_to_fan>, fan_to_dsts>;
using new_fanouts = append_t<typename State::fanouts, fanout_type>;
@@ -340,10 +340,9 @@ struct to_fanout_tuple<TypeList<>> { using type = std::tuple<>; };
template<typename T, std::size_t N, std::size_t Id, typename... Rest>
struct to_fanout_tuple<TypeList<FanoutPlaceholder<T, N, Id>, Rest...>> {
using rest = typename to_fanout_tuple<TypeList<Rest...>>::type;
// prepend FanoutNode<T,N>
template<typename Tuple> struct prepend;
template<typename... Ts> struct prepend<std::tuple<Ts...>> {
using type = std::tuple<kpn::FanoutNode<T, N>, Ts...>;
using type = std::tuple<kpn::FanoutNode<T, N, Id>, Ts...>;
};
using type = typename prepend<rest>::type;
};