diff options
author | yang-g <yangg@google.com> | 2015-08-25 11:05:29 -0700 |
---|---|---|
committer | yang-g <yangg@google.com> | 2015-08-25 11:05:29 -0700 |
commit | d5539ec6e28c275eeb71afaf9bcc5d91a4410e6e (patch) | |
tree | dc166fb1ed97a78e02a87274ed29ffc55ecdea77 | |
parent | 887c094b0b10ca9cf15ba985d99afe4f39875496 (diff) |
remove constexpr since gcc 4.4 or vs2010 does not support it
-rw-r--r-- | include/grpc++/support/string_ref.h | 28 | ||||
-rw-r--r-- | src/cpp/util/string_ref.cc | 2 |
2 files changed, 14 insertions, 16 deletions
diff --git a/include/grpc++/support/string_ref.h b/include/grpc++/support/string_ref.h index 0ec39a9b0a..70bacc9445 100644 --- a/include/grpc++/support/string_ref.h +++ b/include/grpc++/support/string_ref.h @@ -50,22 +50,22 @@ class string_ref { typedef std::reverse_iterator<const_iterator> const_reverse_iterator; // constants - static constexpr size_t npos = size_t(-1); + static size_t npos = size_t(-1); // construct/copy. - constexpr string_ref() : data_(nullptr), length_(0) {} - constexpr string_ref(const string_ref& other) + string_ref() : data_(nullptr), length_(0) {} + string_ref(const string_ref& other) : data_(other.data_), length_(other.length_) {} string_ref& operator=(const string_ref& rhs); string_ref(const char* s); - constexpr string_ref(const char* s, size_t l) : data_(s), length_(l) {} + string_ref(const char* s, size_t l) : data_(s), length_(l) {} string_ref(const grpc::string& s) : data_(s.data()), length_(s.length()) {} // iterators - constexpr const_iterator begin() const { return data_; } - constexpr const_iterator end() const { return data_ + length_; } - constexpr const_iterator cbegin() const { return data_; } - constexpr const_iterator cend() const { return data_ + length_; } + const_iterator begin() const { return data_; } + const_iterator end() const { return data_ + length_; } + const_iterator cbegin() const { return data_; } + const_iterator cend() const { return data_ + length_; } const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); } @@ -80,10 +80,10 @@ class string_ref { } // capacity - constexpr size_t size() const { return length_; } - constexpr size_t length() const { return length_; } - constexpr size_t max_size() const { return length_; } - constexpr bool empty() const { return length_ == 0; } + size_t size() const { return length_; } + size_t length() const { return length_; } + size_t max_size() const { return length_; } + bool empty() const { return length_ == 0; } // element access const char* data() const { return data_; } @@ -95,9 +95,7 @@ class string_ref { size_t find(string_ref s) const; size_t find(char c) const; - // Defined as constexpr in n3442 but C++11 constexpr semantics do not allow - // the implementation of this function to comply. - /* constrexpr */ string_ref substr(size_t pos, size_t n = npos) const; + string_ref substr(size_t pos, size_t n = npos) const; private: const char* data_; diff --git a/src/cpp/util/string_ref.cc b/src/cpp/util/string_ref.cc index 8483e8c2ee..ff6b7617a3 100644 --- a/src/cpp/util/string_ref.cc +++ b/src/cpp/util/string_ref.cc @@ -39,7 +39,7 @@ namespace grpc { -constexpr size_t string_ref::npos; +size_t string_ref::npos; string_ref& string_ref::operator=(const string_ref& rhs) { data_ = rhs.data_; |