Advertisement
Guest User

Untitled

a guest
Apr 1st, 2022
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.47 KB | None | 0 0
  1. Consegui implementar:
  2.  
  3.  
  4. -----
  5. #include <utility>
  6.  
  7.  
  8. template <typename... Seqs>
  9. class ConcatSeq;
  10.  
  11.  
  12. template <uint8_t... Ints1>
  13. struct ConcatSeq<std::integer_sequence<uint8_t, Ints1...>>
  14. {
  15.     using Type = typename std::integer_sequence<uint8_t, Ints1...>;
  16. };
  17.  
  18. template <uint8_t... Ints1, uint8_t... Ints2>
  19. struct ConcatSeq<std::integer_sequence<uint8_t, Ints1...>,
  20. std::integer_sequence<uint8_t, Ints2...>>
  21. {
  22.     using Type = std::integer_sequence<uint8_t, Ints1..., Ints2...>;
  23. };
  24.  
  25. template <uint8_t... Ints1, uint8_t... Ints2, typename... TailSeqs>
  26. struct ConcatSeq<std::integer_sequence<uint8_t, Ints1...>,
  27. std::integer_sequence<uint8_t, Ints2...>, TailSeqs...>
  28. {
  29.     using Type = typename ConcatSeq<std::integer_sequence<uint8_t, Ints1..., Ints2...>, TailSeqs...>::Type;
  30. };
  31.  
  32.  
  33. template <typename... Seqs>
  34. using ConcatSeqType = typename ConcatSeq<Seqs...>::Type;
  35.  
  36.  
  37. using ConcatSeqTest1 = ConcatSeqType<
  38.     std::integer_sequence<uint8_t, 10>
  39. >;
  40.  
  41. using ConcatSeqTest2 = ConcatSeqType<
  42.     std::integer_sequence<uint8_t, 10>,
  43.     std::integer_sequence<uint8_t, 20, 21>
  44. >;
  45.  
  46. using ConcatSeqTest3 = ConcatSeqType<
  47.     std::integer_sequence<uint8_t, 10>,
  48.     std::integer_sequence<uint8_t, 20, 21>,
  49.     std::integer_sequence<uint8_t, 30, 31, 32>
  50. >;
  51.  
  52. using ConcatSeqTest4 = ConcatSeqType<
  53.     std::integer_sequence<uint8_t, 10>,
  54.     std::integer_sequence<uint8_t, 20, 21>,
  55.     std::integer_sequence<uint8_t, 30, 31, 32>,
  56.     std::integer_sequence<uint8_t, 40, 41, 42, 43>
  57. >;
  58. -----
  59.  
  60.  
  61. Adriano
  62.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement