summaryrefslogtreecommitdiff
path: root/absl/container
diff options
context:
space:
mode:
Diffstat (limited to 'absl/container')
-rw-r--r--absl/container/inlined_vector.h25
-rw-r--r--absl/container/internal/inlined_vector.h9
2 files changed, 19 insertions, 15 deletions
diff --git a/absl/container/inlined_vector.h b/absl/container/inlined_vector.h
index 1ab4b2f4..978d5033 100644
--- a/absl/container/inlined_vector.h
+++ b/absl/container/inlined_vector.h
@@ -73,17 +73,12 @@ class InlinedVector {
using AllocatorTraits = typename Storage::AllocatorTraits;
template <typename Iterator>
- using IsAtLeastForwardIterator = std::is_convertible<
- typename std::iterator_traits<Iterator>::iterator_category,
- std::forward_iterator_tag>;
+ using EnableIfAtLeastForwardIterator = absl::enable_if_t<
+ inlined_vector_internal::IsAtLeastForwardIterator<Iterator>::value>;
template <typename Iterator>
- using EnableIfAtLeastForwardIterator =
- absl::enable_if_t<IsAtLeastForwardIterator<Iterator>::value>;
-
- template <typename Iterator>
- using DisableIfAtLeastForwardIterator =
- absl::enable_if_t<!IsAtLeastForwardIterator<Iterator>::value>;
+ using DisableIfAtLeastForwardIterator = absl::enable_if_t<
+ !inlined_vector_internal::IsAtLeastForwardIterator<Iterator>::value>;
using rvalue_reference = typename Storage::rvalue_reference;
@@ -1060,7 +1055,9 @@ class InlinedVector {
template <typename ForwardIt>
void AssignForwardRange(ForwardIt first, ForwardIt last) {
- static_assert(IsAtLeastForwardIterator<ForwardIt>::value, "");
+ static_assert(absl::inlined_vector_internal::IsAtLeastForwardIterator<
+ ForwardIt>::value,
+ "");
auto length = std::distance(first, last);
@@ -1084,7 +1081,9 @@ class InlinedVector {
template <typename ForwardIt>
void AppendForwardRange(ForwardIt first, ForwardIt last) {
- static_assert(IsAtLeastForwardIterator<ForwardIt>::value, "");
+ static_assert(absl::inlined_vector_internal::IsAtLeastForwardIterator<
+ ForwardIt>::value,
+ "");
auto length = std::distance(first, last);
reserve(size() + length);
@@ -1113,7 +1112,9 @@ class InlinedVector {
template <typename ForwardIt>
iterator InsertWithForwardRange(const_iterator position, ForwardIt first,
ForwardIt last) {
- static_assert(IsAtLeastForwardIterator<ForwardIt>::value, "");
+ static_assert(absl::inlined_vector_internal::IsAtLeastForwardIterator<
+ ForwardIt>::value,
+ "");
assert(position >= begin() && position <= end());
if (ABSL_PREDICT_FALSE(first == last))
diff --git a/absl/container/internal/inlined_vector.h b/absl/container/internal/inlined_vector.h
index 168d5b4e..b8b4f4ce 100644
--- a/absl/container/internal/inlined_vector.h
+++ b/absl/container/internal/inlined_vector.h
@@ -26,6 +26,11 @@
namespace absl {
namespace inlined_vector_internal {
+template <typename Iterator>
+using IsAtLeastForwardIterator = std::is_convertible<
+ typename std::iterator_traits<Iterator>::iterator_category,
+ std::forward_iterator_tag>;
+
template <typename InlinedVector>
class Storage;
@@ -89,9 +94,7 @@ class Storage<InlinedVector<T, N, A>> {
void AddSize(size_type count) { GetSizeAndIsAllocated() += count << 1; }
- void SetAllocatedData(pointer data) {
- data_.allocated.allocated_data = data;
- }
+ void SetAllocatedData(pointer data) { data_.allocated.allocated_data = data; }
void SetAllocatedCapacity(size_type capacity) {
data_.allocated.allocated_capacity = capacity;