[libc++] NFC: Fix return-by-const-value and pass-by-const-value typos

While we can debate on the value of passing by const value, there is no
arguing that it's confusing to do so in some circumstances, such as when
marking a pointer parameter as being const (did you mean a pointer-to-const?).
This commit fixes a few issues along those lines.
This commit is contained in:
Louis Dionne 2021-06-29 13:52:26 -04:00
parent 3999dcae5e
commit a562853a51
4 changed files with 7 additions and 7 deletions

View File

@ -144,7 +144,7 @@ public:
public:
reference(const reference&) noexcept;
operator bool() const noexcept;
reference& operator=(const bool x) noexcept;
reference& operator=(bool x) noexcept;
reference& operator=(const reference& x) noexcept;
iterator operator&() const noexcept;
void flip() noexcept;

View File

@ -423,7 +423,7 @@ get_swprintf()
}
template <typename S, typename V>
S i_to_string(const V v)
S i_to_string(V v)
{
// numeric_limits::digits10 returns value less on 1 than desired for unsigned numbers.
// For example, for 1-byte unsigned value digits10 is 2 (999 can not be represented),

View File

@ -40,12 +40,12 @@ public:
template <class U> bool operator==(const counting_allocatorT<U>& other) const noexcept { return foo == other.foo; }
template <class U> bool operator!=(const counting_allocatorT<U>& other) const noexcept { return foo != other.foo; }
T * allocate(const size_t n) const {
T* allocate(size_t n) const {
ca_allocs.push_back(foo);
void * const pv = ::malloc(n * sizeof(T));
return static_cast<T *>(pv);
}
void deallocate(T * const p, size_t) const noexcept {
void deallocate(T* p, size_t) const noexcept {
ca_deallocs.push_back(foo);
free(p);
}
@ -63,12 +63,12 @@ public:
template <class U> bool operator==(const counting_allocatorF<U>& other) const noexcept { return foo == other.foo; }
template <class U> bool operator!=(const counting_allocatorF<U>& other) const noexcept { return foo != other.foo; }
T * allocate(const size_t n) const {
T* allocate(size_t n) const {
ca_allocs.push_back(foo);
void * const pv = ::malloc(n * sizeof(T));
return static_cast<T *>(pv);
}
void deallocate(T * const p, size_t) const noexcept {
void deallocate(T* p, size_t) const noexcept {
ca_deallocs.push_back(foo);
free(p);
}

View File

@ -8,7 +8,7 @@
// <string_view>
// const size_type find_last_not_of(charT c, size_type pos = npos) const;
// size_type find_last_not_of(charT c, size_type pos = npos) const;
#include <string_view>
#include <cassert>