SeqAn3  3.2.0-rc.1
The Modern C++ library for sequence analysis.
common_tuple.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2022, Knut Reinert & MPI für molekulare Genetik
4 // This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5 // shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6 // -----------------------------------------------------------------------------------------------------
7 
13 #pragma once
14 
15 #include <tuple>
16 
19 
20 namespace seqan3
21 {
22 
27 template <class... Types>
28 class common_tuple : public std::tuple<Types...>
29 {
30 private:
32  using base_t = std::tuple<Types...>;
33 
35  template <typename tuple_like_t, std::size_t... N>
36  common_tuple(tuple_like_t && other, std::integer_sequence<size_t, N...>) :
37  base_t((std::forward<std::tuple_element_t<N, tuple_like_t>>(std::get<N>(other)))...)
38  {}
39 
40 public:
44  common_tuple() = default;
45  common_tuple(common_tuple const &) = default;
46  common_tuple & operator=(common_tuple const &) = default;
47  ~common_tuple() = default;
49 
53  base_t & as_base() noexcept
54  {
55  return *this;
56  }
57 
61  base_t const & as_base() const noexcept
62  {
63  return *this;
64  }
65 
70  template <class... UTypes>
71  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes &> && ...)
72  constexpr common_tuple(UTypes &... other) : base_t(other...)
73  {}
74 
75  template <class... UTypes>
76  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes const> && ...)
77  constexpr common_tuple(UTypes const &... other) : base_t(other...)
78  {}
79 
80  template <class... UTypes>
81  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes> && ...)
82  constexpr common_tuple(UTypes &&... other) : base_t(std::forward<UTypes>(other)...)
83  {}
84 
85  template <class... UTypes>
86  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes const> && ...)
87  constexpr common_tuple(UTypes const &&... other) : base_t(std::forward<UTypes const>(other)...)
88  {}
91 
96  template <class... UTypes>
97  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes &> && ...)
98  constexpr common_tuple(common_tuple<UTypes...> & other) : common_tuple(other, std::index_sequence_for<Types...>{})
99  {}
100 
101  template <class... UTypes>
102  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes const> && ...)
103  constexpr common_tuple(common_tuple<UTypes...> const & other) :
104  common_tuple(other, std::index_sequence_for<Types...>{})
105  {}
106 
107  template <class... UTypes>
108  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes> && ...)
109  constexpr common_tuple(common_tuple<UTypes...> && other) :
110  common_tuple(std::move(other), std::index_sequence_for<Types...>{})
111  {}
112 
113  template <class... UTypes>
114  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes const> && ...)
115  constexpr common_tuple(common_tuple<UTypes...> const && other) :
116  common_tuple(std::move(other), std::index_sequence_for<Types...>{})
117  {}
120 
125  template <class... UTypes>
126  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes &> && ...)
127  constexpr common_tuple(common_pair<UTypes...> & other) : common_tuple(other, std::index_sequence_for<Types...>{})
128  {}
129 
130  template <class... UTypes>
131  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes const> && ...)
132  constexpr common_tuple(common_pair<UTypes...> const & other) :
133  common_tuple(other, std::index_sequence_for<Types...>{})
134  {}
135 
136  template <class... UTypes>
137  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes> && ...)
138  constexpr common_tuple(common_pair<UTypes...> && other) :
139  common_tuple(std::move(other), std::index_sequence_for<Types...>{})
140  {}
141 
142  template <class... UTypes>
143  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes const> && ...)
144  constexpr common_tuple(common_pair<UTypes...> const && other) :
145  common_tuple(std::move(other), std::index_sequence_for<Types...>{})
146  {}
149 
154  template <class... UTypes>
155  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes &> && ...)
156  constexpr common_tuple(std::tuple<UTypes...> & other) : common_tuple(other, std::index_sequence_for<Types...>{})
157  {}
158 
159  template <class... UTypes>
160  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes const> && ...)
161  constexpr common_tuple(std::tuple<UTypes...> const & other) :
162  common_tuple(other, std::index_sequence_for<Types...>{})
163  {}
164 
165  template <class... UTypes>
166  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes> && ...)
167  constexpr common_tuple(std::tuple<UTypes...> && other) :
168  common_tuple(std::move(other), std::index_sequence_for<Types...>{})
169  {}
170 
171  template <class... UTypes>
172  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes const> && ...)
173  constexpr common_tuple(std::tuple<UTypes...> const && other) :
174  common_tuple(std::move(other), std::index_sequence_for<Types...>{})
175  {}
176 
181  template <class... UTypes>
182  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes &> && ...)
183  constexpr common_tuple(std::pair<UTypes...> & other) : common_tuple(other, std::index_sequence_for<Types...>{})
184  {}
185 
186  template <class... UTypes>
187  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes const> && ...)
188  constexpr common_tuple(std::pair<UTypes...> const & other) :
189  common_tuple(other, std::index_sequence_for<Types...>{})
190  {}
191 
192  template <class... UTypes>
193  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes> && ...)
194  constexpr common_tuple(std::pair<UTypes...> && other) :
195  common_tuple(std::move(other), std::index_sequence_for<Types...>{})
196  {}
197 
198  template <class... UTypes>
199  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<Types, UTypes const> && ...)
200  constexpr common_tuple(std::pair<UTypes...> const && other) :
201  common_tuple(std::move(other), std::index_sequence_for<Types...>{})
202  {}
205 
210  template <class... UTypes>
211  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types, UTypes &> && ...)
212  constexpr common_tuple & operator=(common_tuple<UTypes...> & other)
213  {
214  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
215  {
216  ((std::get<N>(*this) = std::get<N>(other)), ...);
217  }
218  (std::index_sequence_for<Types...>{});
219 
220  return *this;
221  }
222 
223  template <class... UTypes>
224  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types, UTypes const> && ...)
225  constexpr common_tuple & operator=(common_tuple<UTypes...> const & other)
226  {
227  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
228  {
229  ((std::get<N>(*this) = std::get<N>(other)), ...);
230  }
231  (std::index_sequence_for<Types...>{});
232 
233  return *this;
234  }
235 
236  template <class... UTypes>
237  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types, UTypes> && ...)
238  constexpr common_tuple & operator=(common_tuple<UTypes...> && other)
239  {
240  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
241  {
242  ((std::get<N>(*this) = std::get<N>(other)), ...);
243  }
244  (std::index_sequence_for<Types...>{});
245 
246  return *this;
247  }
248 
249  template <class... UTypes>
250  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types, UTypes const> && ...)
251  constexpr common_tuple & operator=(common_tuple<UTypes...> const && other)
252  {
253  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
254  {
255  ((std::get<N>(*this) = std::get<N>(other)), ...);
256  }
257  (std::index_sequence_for<Types...>{});
258 
259  return *this;
260  }
261 
262  template <class... UTypes>
263  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types const, UTypes &> && ...)
264  constexpr common_tuple const & operator=(common_tuple<UTypes...> & other) const
265  {
266  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
267  {
268  ((std::get<N>(*this) = std::get<N>(other)), ...);
269  }
270  (std::index_sequence_for<Types...>{});
271 
272  return *this;
273  }
274 
275  template <class... UTypes>
276  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types const, UTypes const> && ...)
277  constexpr common_tuple const & operator=(common_tuple<UTypes...> const & other) const
278  {
279  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
280  {
281  ((std::get<N>(*this) = std::get<N>(other)), ...);
282  }
283  (std::index_sequence_for<Types...>{});
284 
285  return *this;
286  }
287 
288  template <class... UTypes>
289  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types const, UTypes> && ...)
290  constexpr common_tuple const & operator=(common_tuple<UTypes...> && other) const
291  {
292  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
293  {
294  ((std::get<N>(*this) = std::get<N>(other)), ...);
295  }
296  (std::index_sequence_for<Types...>{});
297 
298  return *this;
299  }
300 
301  template <class... UTypes>
302  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types const, UTypes const> && ...)
303  constexpr common_tuple const & operator=(common_tuple<UTypes...> const && other) const
304  {
305  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
306  {
307  ((std::get<N>(*this) = std::get<N>(other)), ...);
308  }
309  (std::index_sequence_for<Types...>{});
310 
311  return *this;
312  }
315 
320  template <class... UTypes>
321  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types, UTypes &> && ...)
322  constexpr common_tuple & operator=(common_pair<UTypes...> & other)
323  {
324  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
325  {
326  ((std::get<N>(*this) = std::get<N>(other)), ...);
327  }
328  (std::index_sequence_for<Types...>{});
329 
330  return *this;
331  }
332 
333  template <class... UTypes>
334  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types, UTypes const> && ...)
335  constexpr common_tuple & operator=(common_pair<UTypes...> const & other)
336  {
337  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
338  {
339  ((std::get<N>(*this) = std::get<N>(other)), ...);
340  }
341  (std::index_sequence_for<Types...>{});
342 
343  return *this;
344  }
345 
346  template <class... UTypes>
347  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types, UTypes> && ...)
348  constexpr common_tuple & operator=(common_pair<UTypes...> && other)
349  {
350  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
351  {
352  ((std::get<N>(*this) = std::get<N>(other)), ...);
353  }
354  (std::index_sequence_for<Types...>{});
355 
356  return *this;
357  }
358 
359  template <class... UTypes>
360  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types, UTypes const> && ...)
361  constexpr common_tuple & operator=(common_pair<UTypes...> const && other)
362  {
363  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
364  {
365  ((std::get<N>(*this) = std::get<N>(other)), ...);
366  }
367  (std::index_sequence_for<Types...>{});
368 
369  return *this;
370  }
371 
372  template <class... UTypes>
373  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types const, UTypes &> && ...)
374  constexpr common_tuple const & operator=(common_pair<UTypes...> & other) const
375  {
376  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
377  {
378  ((std::get<N>(*this) = std::get<N>(other)), ...);
379  }
380  (std::index_sequence_for<Types...>{});
381 
382  return *this;
383  }
384 
385  template <class... UTypes>
386  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types const, UTypes const> && ...)
387  constexpr common_tuple const & operator=(common_pair<UTypes...> const & other) const
388  {
389  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
390  {
391  ((std::get<N>(*this) = std::get<N>(other)), ...);
392  }
393  (std::index_sequence_for<Types...>{});
394 
395  return *this;
396  }
397 
398  template <class... UTypes>
399  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types const, UTypes> && ...)
400  constexpr common_tuple const & operator=(common_pair<UTypes...> && other) const
401  {
402  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
403  {
404  ((std::get<N>(*this) = std::get<N>(other)), ...);
405  }
406  (std::index_sequence_for<Types...>{});
407 
408  return *this;
409  }
410 
411  template <class... UTypes>
412  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types const, UTypes const> && ...)
413  constexpr common_tuple const & operator=(common_pair<UTypes...> const && other) const
414  {
415  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
416  {
417  ((std::get<N>(*this) = std::get<N>(other)), ...);
418  }
419  (std::index_sequence_for<Types...>{});
420 
421  return *this;
422  }
425 
430  template <class... UTypes>
431  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types, UTypes &> && ...)
432  constexpr common_tuple & operator=(std::tuple<UTypes...> & other)
433  {
434  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
435  {
436  ((std::get<N>(*this) = std::get<N>(other)), ...);
437  }
438  (std::index_sequence_for<Types...>{});
439 
440  return *this;
441  }
442 
443  template <class... UTypes>
444  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types, UTypes const> && ...)
445  constexpr common_tuple & operator=(std::tuple<UTypes...> const & other)
446  {
447  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
448  {
449  ((std::get<N>(*this) = std::get<N>(other)), ...);
450  }
451  (std::index_sequence_for<Types...>{});
452 
453  return *this;
454  }
455 
456  template <class... UTypes>
457  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types, UTypes> && ...)
458  constexpr common_tuple & operator=(std::tuple<UTypes...> && other)
459  {
460  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
461  {
462  ((std::get<N>(*this) = std::get<N>(other)), ...);
463  }
464  (std::index_sequence_for<Types...>{});
465 
466  return *this;
467  }
468 
469  template <class... UTypes>
470  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types, UTypes const> && ...)
471  constexpr common_tuple & operator=(std::tuple<UTypes...> const && other)
472  {
473  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
474  {
475  ((std::get<N>(*this) = std::get<N>(other)), ...);
476  }
477  (std::index_sequence_for<Types...>{});
478 
479  return *this;
480  }
481 
482  template <class... UTypes>
483  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types const, UTypes &> && ...)
484  constexpr common_tuple const & operator=(std::tuple<UTypes...> & other) const
485  {
486  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
487  {
488  ((std::get<N>(*this) = std::get<N>(other)), ...);
489  }
490  (std::index_sequence_for<Types...>{});
491 
492  return *this;
493  }
494 
495  template <class... UTypes>
496  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types const, UTypes const> && ...)
497  constexpr common_tuple const & operator=(std::tuple<UTypes...> const & other) const
498  {
499  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
500  {
501  ((std::get<N>(*this) = std::get<N>(other)), ...);
502  }
503  (std::index_sequence_for<Types...>{});
504 
505  return *this;
506  }
507 
508  template <class... UTypes>
509  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types const, UTypes> && ...)
510  constexpr common_tuple const & operator=(std::tuple<UTypes...> && other) const
511  {
512  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
513  {
514  ((std::get<N>(*this) = std::get<N>(other)), ...);
515  }
516  (std::index_sequence_for<Types...>{});
517 
518  return *this;
519  }
520 
521  template <class... UTypes>
522  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types const, UTypes const> && ...)
523  constexpr common_tuple const & operator=(std::tuple<UTypes...> const && other) const
524  {
525  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
526  {
527  ((std::get<N>(*this) = std::get<N>(other)), ...);
528  }
529  (std::index_sequence_for<Types...>{});
530 
531  return *this;
532  }
535 
540  template <class... UTypes>
541  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types, UTypes &> && ...)
542  constexpr common_tuple & operator=(std::pair<UTypes...> & other)
543  {
544  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
545  {
546  ((std::get<N>(*this) = std::get<N>(other)), ...);
547  }
548  (std::index_sequence_for<Types...>{});
549 
550  return *this;
551  }
552 
553  template <class... UTypes>
554  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types, UTypes const> && ...)
555  constexpr common_tuple & operator=(std::pair<UTypes...> const & other)
556  {
557  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
558  {
559  ((std::get<N>(*this) = std::get<N>(other)), ...);
560  }
561  (std::index_sequence_for<Types...>{});
562 
563  return *this;
564  }
565 
566  template <class... UTypes>
567  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types, UTypes> && ...)
568  constexpr common_tuple & operator=(std::pair<UTypes...> && other)
569  {
570  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
571  {
572  ((std::get<N>(*this) = std::get<N>(other)), ...);
573  }
574  (std::index_sequence_for<Types...>{});
575 
576  return *this;
577  }
578 
579  template <class... UTypes>
580  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types, UTypes const> && ...)
581  constexpr common_tuple & operator=(std::pair<UTypes...> const && other)
582  {
583  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
584  {
585  ((std::get<N>(*this) = std::get<N>(other)), ...);
586  }
587  (std::index_sequence_for<Types...>{});
588 
589  return *this;
590  }
591 
592  template <class... UTypes>
593  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types const, UTypes &> && ...)
594  constexpr common_tuple const & operator=(std::pair<UTypes...> & other) const
595  {
596  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
597  {
598  ((std::get<N>(*this) = std::get<N>(other)), ...);
599  }
600  (std::index_sequence_for<Types...>{});
601 
602  return *this;
603  }
604 
605  template <class... UTypes>
606  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types const, UTypes const> && ...)
607  constexpr common_tuple const & operator=(std::pair<UTypes...> const & other) const
608  {
609  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
610  {
611  ((std::get<N>(*this) = std::get<N>(other)), ...);
612  }
613  (std::index_sequence_for<Types...>{});
614 
615  return *this;
616  }
617 
618  template <class... UTypes>
619  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types const, UTypes> && ...)
620  constexpr common_tuple const & operator=(std::pair<UTypes...> && other) const
621  {
622  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
623  {
624  ((std::get<N>(*this) = std::get<N>(other)), ...);
625  }
626  (std::index_sequence_for<Types...>{});
627 
628  return *this;
629  }
630 
631  template <class... UTypes>
632  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_assignable_v<Types const, UTypes const> && ...)
633  constexpr common_tuple const & operator=(std::pair<UTypes...> const && other) const
634  {
635  [&]<size_t... N>(std::integer_sequence<size_t, N...>)
636  {
637  ((std::get<N>(*this) = std::get<N>(other)), ...);
638  }
639  (std::index_sequence_for<Types...>{});
640 
641  return *this;
642  }
645 
650  template <class... UTypes>
651  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<UTypes, Types &> && ...)
652  operator std::tuple<UTypes...>() &
653  {
654  return std::make_from_tuple<std::tuple<UTypes...>>(*this);
655  }
656 
657  template <class... UTypes>
658  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<UTypes, Types const> && ...)
659  operator std::tuple<UTypes...>() const &
660  {
661  return std::make_from_tuple<std::tuple<UTypes...>>(*this);
662  }
663 
664  template <class... UTypes>
665  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<UTypes, Types> && ...)
666  operator std::tuple<UTypes...>() &&
667  {
668  return std::make_from_tuple<std::tuple<UTypes...>>(std::move(*this));
669  }
670 
671  template <class... UTypes>
672  requires (sizeof...(Types) == sizeof...(UTypes)) && (std::is_constructible_v<UTypes, Types const> && ...)
673  operator std::tuple<UTypes...>() const &&
674  {
675  return std::make_from_tuple<std::tuple<UTypes...>>(std::move(*this));
676  }
679 
689  template <class... UTypes>
690  requires (sizeof...(Types) == sizeof...(UTypes))
691  && requires { requires (std::equality_comparable_with<Types, UTypes> && ...); } // Defer instantiation
692  constexpr friend bool operator==(common_tuple const & lhs, common_tuple<UTypes...> const & rhs)
693  {
694  static_assert((std::equality_comparable_with<Types, UTypes> && ...));
695  return lhs.as_base() == rhs.as_base();
696  }
697 
704  template <class... UTypes>
705  requires (sizeof...(Types) == sizeof...(UTypes))
706  && requires { requires (std::equality_comparable_with<Types, UTypes> && ...); } // Defer instantiation
707  constexpr friend bool operator!=(common_tuple const & lhs, common_tuple<UTypes...> const & rhs)
708  {
709  return lhs.as_base() != rhs.as_base();
710  }
711 
718  template <class... UTypes>
719  requires (sizeof...(Types) == sizeof...(UTypes))
720  && requires { requires (std::totally_ordered_with<Types, UTypes> && ...); } // Defer instantiation
721  constexpr friend bool operator<(common_tuple const & lhs, common_tuple<UTypes...> const & rhs)
722  {
723  return lhs.as_base() < rhs.as_base();
724  }
725 
732  template <class... UTypes>
733  requires (sizeof...(Types) == sizeof...(UTypes))
734  && requires { requires (std::totally_ordered_with<Types, UTypes> && ...); } // Defer instantiation
735  constexpr friend bool operator<=(common_tuple const & lhs, common_tuple<UTypes...> const & rhs)
736  {
737  return lhs.as_base() <= rhs.as_base();
738  }
739 
746  template <class... UTypes>
747  requires (sizeof...(Types) == sizeof...(UTypes))
748  && requires { requires (std::totally_ordered_with<Types, UTypes> && ...); } // Defer instantiation
749  constexpr friend bool operator>(common_tuple const & lhs, common_tuple<UTypes...> const & rhs)
750  {
751  return lhs.as_base() > rhs.as_base();
752  }
753 
760  template <class... UTypes>
761  requires (sizeof...(Types) == sizeof...(UTypes))
762  && requires { requires (std::totally_ordered_with<Types, UTypes> && ...); } // Defer instantiation
763  constexpr friend bool operator>=(common_tuple const & lhs, common_tuple<UTypes...> const & rhs)
764  {
765  return lhs.as_base() >= rhs.as_base();
766  }
767 
768 #ifdef __cpp_lib_three_way_comparison
776  template <class... UTypes>
777  requires (sizeof...(Types) == sizeof...(UTypes))
778  && requires { requires (std::three_way_comparable_with<Types, UTypes> && ...); } // Defer instantiation
779  constexpr friend auto operator<=>(common_tuple const & lhs, common_tuple<UTypes...> const & rhs)
780  {
781  return lhs.as_base() <=> rhs.as_base();
782  }
783 #endif // __cpp_lib_three_way_comparison
785 
795  template <class... UTypes>
796  requires (sizeof...(Types) == sizeof...(UTypes))
797  && requires { requires (std::equality_comparable_with<Types, UTypes> && ...); } // Defer instantiation
798  constexpr friend bool operator==(common_tuple const & lhs, std::tuple<UTypes...> const & rhs)
799  {
800  return lhs.as_base() == rhs;
801  }
802 
809  template <class... UTypes>
810  requires (sizeof...(Types) == sizeof...(UTypes))
811  && requires { requires (std::equality_comparable_with<Types, UTypes> && ...); } // Defer instantiation
812  constexpr friend bool operator!=(common_tuple const & lhs, std::tuple<UTypes...> const & rhs)
813  {
814  return lhs.as_base() != rhs;
815  }
816 
823  template <class... UTypes>
824  requires (sizeof...(Types) == sizeof...(UTypes))
825  && requires { requires (std::totally_ordered_with<Types, UTypes> && ...); } // Defer instantiation
826  constexpr friend bool operator<(common_tuple const & lhs, std::tuple<UTypes...> const & rhs)
827  {
828  return lhs.as_base() < rhs;
829  }
830 
837  template <class... UTypes>
838  requires (sizeof...(Types) == sizeof...(UTypes))
839  && requires { requires (std::totally_ordered_with<Types, UTypes> && ...); } // Defer instantiation
840  constexpr friend bool operator<=(common_tuple const & lhs, std::tuple<UTypes...> const & rhs)
841  {
842  return lhs.as_base() <= rhs;
843  }
844 
851  template <class... UTypes>
852  requires (sizeof...(Types) == sizeof...(UTypes))
853  && requires { requires (std::totally_ordered_with<Types, UTypes> && ...); } // Defer instantiation
854  constexpr friend bool operator>(common_tuple const & lhs, std::tuple<UTypes...> const & rhs)
855  {
856  return lhs.as_base() > rhs;
857  }
858 
865  template <class... UTypes>
866  requires (sizeof...(Types) == sizeof...(UTypes))
867  && requires { requires (std::totally_ordered_with<Types, UTypes> && ...); } // Defer instantiation
868  constexpr friend bool operator>=(common_tuple const & lhs, std::tuple<UTypes...> const & rhs)
869  {
870  return lhs.as_base() >= rhs;
871  }
872 
873 #ifdef __cpp_lib_three_way_comparison
881  template <class... UTypes>
882  requires (sizeof...(Types) == sizeof...(UTypes))
883  && requires { requires (std::three_way_comparable_with<Types, UTypes> && ...); } // Defer instantiation
884  constexpr friend auto operator<=>(common_tuple const & lhs, std::tuple<UTypes...> const & rhs)
885  {
886  return lhs.as_base() <=> rhs;
887  }
888 #endif // __cpp_lib_three_way_comparison
890 };
891 
893 template <class... UTypes>
894 common_tuple(UTypes...) -> common_tuple<UTypes...>;
895 
896 } // namespace seqan3
897 
899 namespace std
900 {
901 
902 template <typename... args>
903 struct tuple_size<seqan3::common_tuple<args...>> : public tuple_size<std::tuple<args...>>
904 {};
905 
906 template <size_t index, typename... args>
907 struct tuple_element<index, seqan3::common_tuple<args...>> : public tuple_element<index, std::tuple<args...>>
908 {};
909 
910 template <class... Ts, class... Us>
912 struct common_type<seqan3::common_tuple<Ts...>, seqan3::common_tuple<Us...>>
913 {
915 };
916 
917 template <class... Ts, class... Us>
919 struct common_type<std::tuple<Ts...>, seqan3::common_tuple<Us...>>
920 {
922 };
923 
924 template <class... Ts, class... Us>
926 struct common_type<seqan3::common_tuple<Ts...>, std::tuple<Us...>>
927 {
929 };
930 
931 template <class... Ts, class... Us, template <class> class TQual, template <class> class UQual>
933 struct basic_common_reference<seqan3::common_tuple<Ts...>, seqan3::common_tuple<Us...>, TQual, UQual>
934 {
935  using type = seqan3::common_tuple<std::common_reference_t<TQual<Ts>, UQual<Us>>...>;
936 };
937 
938 template <class... Ts, class... Us, template <class> class TQual, template <class> class UQual>
940 struct basic_common_reference<seqan3::common_tuple<Ts...>, std::tuple<Us...>, TQual, UQual>
941 {
942  using type = seqan3::common_tuple<std::common_reference_t<TQual<Ts>, UQual<Us>>...>;
943 };
944 
945 template <class... Ts, class... Us, template <class> class TQual, template <class> class UQual>
947 struct basic_common_reference<std::tuple<Ts...>, seqan3::common_tuple<Us...>, TQual, UQual>
948 {
949  using type = seqan3::common_tuple<std::common_reference_t<TQual<Ts>, UQual<Us>>...>;
950 };
951 
952 template <std::size_t i, typename... types>
953 constexpr std::tuple_element_t<i, seqan3::common_tuple<types...>> & get(seqan3::common_tuple<types...> & t) noexcept
954  requires (i < sizeof...(types))
955 {
956  return std::get<i>(static_cast<std::tuple<types...> &>(t));
957 }
958 
959 template <std::size_t i, typename... types>
960 constexpr std::tuple_element_t<i, seqan3::common_tuple<types...>> const &
961 get(seqan3::common_tuple<types...> const & t) noexcept
962  requires (i < sizeof...(types))
963 {
964  return std::get<i>(static_cast<std::tuple<types...> const &>(t));
965 }
966 
967 template <std::size_t i, typename... types>
968 constexpr std::tuple_element_t<i, seqan3::common_tuple<types...>> && get(seqan3::common_tuple<types...> && t) noexcept
969  requires (i < sizeof...(types))
970 {
971  return std::get<i>(static_cast<std::tuple<types...> &&>(std::move(t)));
972 }
973 
974 template <std::size_t i, typename... types>
975 constexpr std::tuple_element_t<i, seqan3::common_tuple<types...>> const &&
976 get(seqan3::common_tuple<types...> const && t) noexcept
977  requires (i < sizeof...(types))
978 {
979  return std::get<i>(static_cast<std::tuple<types...> const &&>(std::move(t)));
980 }
981 
982 template <typename type, typename... types>
983 constexpr type & get(seqan3::common_tuple<types...> & t) noexcept
984  requires (seqan3::pack_traits::count<type, types...> == 1)
985 {
986  return std::get<type>(static_cast<std::tuple<types...> &>(t));
987 }
988 
989 template <typename type, typename... types>
990 constexpr type const & get(seqan3::common_tuple<types...> const & t) noexcept
991  requires (seqan3::pack_traits::count<type, types...> == 1)
992 {
993  return std::get<type>(static_cast<std::tuple<types...> const &>(t));
994 }
995 
996 template <typename type, typename... types>
997 constexpr type && get(seqan3::common_tuple<types...> && t) noexcept
998  requires (seqan3::pack_traits::count<type, types...> == 1)
999 {
1000  return std::get<type>(static_cast<std::tuple<types...> &&>(std::move(t)));
1001 }
1002 
1003 template <typename type, typename... types>
1004 constexpr type const && get(seqan3::common_tuple<types...> const && t) noexcept
1005  requires (seqan3::pack_traits::count<type, types...> == 1)
1006 {
1007  return std::get<type>(static_cast<std::tuple<types...> const &&>(std::move(t)));
1008 }
1009 
1010 } // namespace std
A std::tuple implementation that incorporates most changes from C++23's standard library.
Definition: common_tuple.hpp:29
common_tuple & operator=(common_tuple const &)=default
Defaulted.
constexpr friend bool operator>(common_tuple const &lhs, common_tuple< UTypes... > const &rhs)
Checks whether lhs and rhs are equal.
Definition: common_tuple.hpp:744
requires(sizeof...(Types)==sizeof...(UTypes)) &&requires
Checks whether lhs and rhs are equal.
Definition: common_tuple.hpp:690
constexpr friend bool operator<(common_tuple const &lhs, common_tuple< UTypes... > const &rhs)
Checks whether lhs and rhs are equal.
Definition: common_tuple.hpp:718
common_tuple()=default
Defaulted.
constexpr friend auto operator<=>(common_tuple const &lhs, common_tuple< UTypes... > const &rhs)
Checks whether lhs and rhs are equal.
Definition: common_tuple.hpp:772
constexpr friend bool operator==(common_tuple const &lhs, common_tuple< UTypes... > const &rhs)
Checks whether lhs and rhs are equal.
Definition: common_tuple.hpp:691
common_tuple(common_tuple const &)=default
Defaulted.
constexpr friend bool operator>=(common_tuple const &lhs, common_tuple< UTypes... > const &rhs)
Checks whether lhs and rhs are equal.
Definition: common_tuple.hpp:757
requires(sizeof...(Types)==sizeof...(UTypes)) &&(std
Constructs from arguments.
Definition: common_tuple.hpp:71
constexpr friend bool operator!=(common_tuple const &lhs, common_tuple< UTypes... > const &rhs)
Checks whether lhs and rhs are equal.
Definition: common_tuple.hpp:705
constexpr friend bool operator<=(common_tuple const &lhs, common_tuple< UTypes... > const &rhs)
Checks whether lhs and rhs are equal.
Definition: common_tuple.hpp:731
Provides seqan3::common_pair.
T forward(T... args)
requires requires
The rank_type of the semi-alphabet; defined as the return type of seqan3::to_rank....
Definition: alphabet/concept.hpp:164
T make_from_tuple(T... args)
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
constexpr auto const & get(configuration< configs_t... > const &config) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: configuration.hpp:415
common_tuple(UTypes...) -> common_tuple< UTypes... >
Class template argument deduction guide.
SeqAn specific customisations in the standard namespace.
A std::pair implementation that incorporates most changes from C++23's standard library.
Definition: common_pair.hpp:28
Provides various traits for template packs.