aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include/ImmutableSortedVector.h
diff options
context:
space:
mode:
authorRobert Schumacher <roschuma@microsoft.com>2017-04-01 03:30:52 -0700
committerRobert Schumacher <roschuma@microsoft.com>2017-04-01 03:30:52 -0700
commitb788c2b2098093843d4521d12a617199af39e7dc (patch)
treeffcd55b39c9019adab6993c99dde130fa2aceb5d /toolsrc/include/ImmutableSortedVector.h
parentbb865fb312d9f603a18a40768ae357da0421905d (diff)
downloadvcpkg-b788c2b2098093843d4521d12a617199af39e7dc.tar.gz
vcpkg-b788c2b2098093843d4521d12a617199af39e7dc.zip
[vcpkg] ImmutableSortedVector is actually Mutable via move.
Use fmap instead of construct/insert. Don't cache VS2015 instances since it is called once. Add ParagraphDataMap alias.
Diffstat (limited to 'toolsrc/include/ImmutableSortedVector.h')
-rw-r--r--toolsrc/include/ImmutableSortedVector.h73
1 files changed, 0 insertions, 73 deletions
diff --git a/toolsrc/include/ImmutableSortedVector.h b/toolsrc/include/ImmutableSortedVector.h
deleted file mode 100644
index 0756068eb..000000000
--- a/toolsrc/include/ImmutableSortedVector.h
+++ /dev/null
@@ -1,73 +0,0 @@
-#pragma once
-
-#include <vector>
-#include <algorithm>
-
-// Add more forwarding functions to the delegate std::vector as needed.
-namespace vcpkg
-{
- template <class T>
- class ImmutableSortedVector
- {
- typedef typename std::vector<T>::size_type size_type;
-
- public:
- static ImmutableSortedVector<T> create(std::vector<T> vector)
- {
- ImmutableSortedVector out;
- out.delegate = std::move(vector);
- if (!std::is_sorted(out.delegate.cbegin(), out.delegate.cend()))
- {
- std::sort(out.delegate.begin(), out.delegate.end());
- }
-
- return out;
- }
-
- template <class Compare>
- static ImmutableSortedVector<T> create(std::vector<T> vector, Compare comp)
- {
- ImmutableSortedVector<T> out;
- out.delegate = std::move(vector);
- if (!std::is_sorted(out.delegate.cbegin(), out.delegate.cend(), comp))
- {
- std::sort(out.delegate.begin(), out.delegate.end(), comp);
- }
-
- return out;
- }
-
- typename std::vector<T>::const_iterator begin() const
- {
- return this->delegate.cbegin();
- }
-
- typename std::vector<T>::const_iterator end() const
- {
- return this->delegate.cend();
- }
-
- typename std::vector<T>::const_iterator cbegin() const
- {
- return this->delegate.cbegin();
- }
-
- typename std::vector<T>::const_iterator cend() const
- {
- return this->delegate.cend();
- }
-
- bool empty() const
- {
- return this->delegate.empty();
- }
-
- size_type size() const
- {
- return this->delegate.size();
- }
-
- private:
- std::vector<T> delegate;
- };
-}