aboutsummaryrefslogtreecommitdiff
path: root/absl/container/inlined_vector.h
diff options
context:
space:
mode:
authorGennadiy Civil <gennadiycivil@users.noreply.github.com>2017-10-05 19:52:46 -0400
committerGennadiy Civil <gennadiycivil@users.noreply.github.com>2017-10-05 19:52:46 -0400
commit764d4bd0fe96250c2d6e81595c04b15600576e0c (patch)
tree23d5ae8b9127b2cc5a3613cab4586d7d686a0793 /absl/container/inlined_vector.h
parent5e1a8e8daddc9bf04dcd41ae7028dd4298a839d1 (diff)
parentd732f2014bdd141135e6af06ee5b47e7fbe4b877 (diff)
downloadabseil-764d4bd0fe96250c2d6e81595c04b15600576e0c.tar.gz
abseil-764d4bd0fe96250c2d6e81595c04b15600576e0c.tar.bz2
abseil-764d4bd0fe96250c2d6e81595c04b15600576e0c.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'absl/container/inlined_vector.h')
-rw-r--r--absl/container/inlined_vector.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/absl/container/inlined_vector.h b/absl/container/inlined_vector.h
index f060f5c5..f68ca507 100644
--- a/absl/container/inlined_vector.h
+++ b/absl/container/inlined_vector.h
@@ -124,9 +124,24 @@ class InlinedVector {
InlinedVector(const InlinedVector& v);
InlinedVector(const InlinedVector& v, const allocator_type& alloc);
+ // This move constructor does not allocate and only moves the underlying
+ // objects, so its `noexcept` specification depends on whether moving the
+ // underlying objects can throw or not. We assume
+ // a) move constructors should only throw due to allocation failure and
+ // b) if `value_type`'s move constructor allocates, it uses the same
+ // allocation function as the `InlinedVector`'s allocator, so the move
+ // constructor is non-throwing if the allocator is non-throwing or
+ // `value_type`'s move constructor is specified as `noexcept`.
InlinedVector(InlinedVector&& v) noexcept(
absl::allocator_is_nothrow<allocator_type>::value ||
std::is_nothrow_move_constructible<value_type>::value);
+
+ // This move constructor allocates and also moves the underlying objects, so
+ // its `noexcept` specification depends on whether the allocation can throw
+ // and whether moving the underlying objects can throw. Based on the same
+ // assumptions above, the `noexcept` specification is dominated by whether the
+ // allocation can throw regardless of whether `value_type`'s move constructor
+ // is specified as `noexcept`.
InlinedVector(InlinedVector&& v, const allocator_type& alloc) noexcept(
absl::allocator_is_nothrow<allocator_type>::value);