[PATCH] D24880: Add StringExtras join_items function
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 27 09:03:19 PDT 2016
zturner added inline comments.
================
Comment at: include/llvm/ADT/StringExtras.h:226
@@ +225,3 @@
+ return join_one_item_size(A) +
+ join_items_size(B, std::forward<Args>(Items)...);
+}
----------------
mehdi_amini wrote:
> Do you need the B in this function?
My understanding is that it is needed to disambiguate the two overloads. If you have these two:
```
template <typename A1>
size_t join_items_size(const A1 &A) {
}
template<typename A1, typename... As>
size_t join_items_size(const A1 &A, As &&... Items) {
}
```
Then if you call it as:
```
size_t x = join_items_size("Test");
```
it will be ambiguous, because the second overload could have a parameter pack of size 0. Correct me if I'm wrong though, I admit I am not an expert here :)
https://reviews.llvm.org/D24880
More information about the llvm-commits
mailing list