Skip to content

Commit 562fe41

Browse files
[ADT] Use std::conditional_t to simplify ilist_select_iterator_type (NFC) (#159240)
Without this patch, ilist_select_iterator_type uses a boolean template parameter to select one of two types. This patch converts that to std::conditional_t, which is simpler than the two-class solution.
1 parent 36c0eab commit 562fe41

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

llvm/include/llvm/ADT/ilist_node.h

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,10 @@ template <class OptionsT> class ilist_sentinel;
5252

5353
// Selector for which iterator type to pick given the iterator-bits node option.
5454
template <bool use_iterator_bits, typename Opts, bool arg1, bool arg2>
55-
class ilist_select_iterator_type {
56-
public:
57-
using type = ilist_iterator<Opts, arg1, arg2>;
58-
};
59-
template <typename Opts, bool arg1, bool arg2>
60-
class ilist_select_iterator_type<true, Opts, arg1, arg2> {
61-
public:
62-
using type = ilist_iterator_w_bits<Opts, arg1, arg2>;
55+
struct ilist_select_iterator_type {
56+
using type = std::conditional_t<use_iterator_bits,
57+
ilist_iterator_w_bits<Opts, arg1, arg2>,
58+
ilist_iterator<Opts, arg1, arg2>>;
6359
};
6460

6561
/// Implementation for an ilist node.

0 commit comments

Comments
 (0)