diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2016-07-14 15:36:32 -0400 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2016-07-14 15:52:50 -0400 |
commit | d1e1b5b80c1ae83c0180fef1fde093e3f1e24cae (patch) | |
tree | a6555e1797069785d06bbe6df1159c047ee40eb6 /src/mongo/base | |
parent | 472ac6b5bcb50e8869d03ecb044ce8ed3d779954 (diff) | |
download | mongo-d1e1b5b80c1ae83c0180fef1fde093e3f1e24cae.tar.gz |
SERVER-24572 Add support for collecting information from /proc/stat
Diffstat (limited to 'src/mongo/base')
-rw-r--r-- | src/mongo/base/error_codes.err | 1 | ||||
-rw-r--r-- | src/mongo/base/string_data.h | 24 |
2 files changed, 22 insertions, 3 deletions
diff --git a/src/mongo/base/error_codes.err b/src/mongo/base/error_codes.err index 3979f9bdf59..aa3c0b24803 100644 --- a/src/mongo/base/error_codes.err +++ b/src/mongo/base/error_codes.err @@ -172,6 +172,7 @@ error_code("TooManyMatchingDocuments", 170) error_code("CannotIndexParallelArrays", 171) error_code("TransportSessionNotFound", 172) error_code("QueryPlanKilled", 173) +error_code("FileOpenFailed", 174) # Non-sequential error codes (for compatibility only) error_code("SocketException", 9001) diff --git a/src/mongo/base/string_data.h b/src/mongo/base/string_data.h index b1491b919e6..98a4dc6f7f1 100644 --- a/src/mongo/base/string_data.h +++ b/src/mongo/base/string_data.h @@ -36,6 +36,7 @@ #include <stdexcept> #include <string> +#include "mongo/stdx/type_traits.h" #define MONGO_INCLUDE_INVARIANT_H_WHITELISTED #include "mongo/util/invariant.h" #undef MONGO_INCLUDE_INVARIANT_H_WHITELISTED @@ -63,6 +64,9 @@ public: // Declared in string_data_comparator_interface.h. class ComparatorInterface; + // Iterator type + using const_iterator = const char*; + /** Constructs an empty StringData. */ constexpr StringData() = default; @@ -98,6 +102,23 @@ public: constexpr friend StringData operator"" _sd(const char* c, std::size_t len); /** + * Constructs a StringData with begin and end iterators. begin points to the beginning of the + * string. end points to the position past the end of the string. In a null-terminated string, + * end points to the null-terminator. + * + * We template the second parameter to ensure if StringData is called with 0 in the second + * parameter, the (ptr,len) constructor is chosen instead. + */ + template < + typename InputIt, + typename = stdx::enable_if_t<std::is_same<StringData::const_iterator, InputIt>::value>> + StringData(InputIt begin, InputIt end) { + invariant(begin && end); + _data = begin; + _size = std::distance(begin, end); + } + + /** * Returns -1, 0, or 1 if 'this' is less, equal, or greater than 'other' in * lexicographical order. */ @@ -170,9 +191,6 @@ public: // // iterators // - - typedef const char* const_iterator; - const_iterator begin() const { return rawData(); } |