Commit b57cfc00 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 9

Fix infinite recursion in sorted_vector_{set|map}::insert(const value_type&)

Summary:
We were calling ourself, which MSVC correctly identified:
```
warning C4717: 'folly::sorted_vector_set<int,`anonymous namespace'::less_invert<int>,std::allocator<int>,void>::insert': recursive on all control paths, function will cause runtime stack overflow
```

Just add an explicit `std::move` in to solve the problem.

Reviewed By: yfeldblum

Differential Revision: D3447922

fbshipit-source-id: 803f79510b3dbfeea32a9629238448f69f5b78dc
parent 0f2aacae
...@@ -244,7 +244,7 @@ public: ...@@ -244,7 +244,7 @@ public:
size_type capacity() const { return m_.cont_.capacity(); } size_type capacity() const { return m_.cont_.capacity(); }
std::pair<iterator,bool> insert(const value_type& value) { std::pair<iterator,bool> insert(const value_type& value) {
return insert(value_type(value)); return insert(std::move(value_type(value)));
} }
std::pair<iterator,bool> insert(value_type&& value) { std::pair<iterator,bool> insert(value_type&& value) {
...@@ -257,7 +257,7 @@ public: ...@@ -257,7 +257,7 @@ public:
} }
iterator insert(iterator hint, const value_type& value) { iterator insert(iterator hint, const value_type& value) {
return insert(hint, value_type(value)); return insert(hint, std::move(value_type(value)));
} }
iterator insert(iterator hint, value_type&& value) { iterator insert(iterator hint, value_type&& value) {
...@@ -488,7 +488,7 @@ public: ...@@ -488,7 +488,7 @@ public:
size_type capacity() const { return m_.cont_.capacity(); } size_type capacity() const { return m_.cont_.capacity(); }
std::pair<iterator,bool> insert(const value_type& value) { std::pair<iterator,bool> insert(const value_type& value) {
return insert(value_type(value)); return insert(std::move(value_type(value)));
} }
std::pair<iterator,bool> insert(value_type&& value) { std::pair<iterator,bool> insert(value_type&& value) {
...@@ -501,7 +501,7 @@ public: ...@@ -501,7 +501,7 @@ public:
} }
iterator insert(iterator hint, const value_type& value) { iterator insert(iterator hint, const value_type& value) {
return insert(hint, value_type(value)); return insert(hint, std::move(value_type(value)));
} }
iterator insert(iterator hint, value_type&& value) { iterator insert(iterator hint, value_type&& value) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment