Skip to content

Commit a562853

Browse files
committed
[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.
1 parent 3999dca commit a562853

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

libcxx/include/vector

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public:
144144
public:
145145
reference(const reference&) noexcept;
146146
operator bool() const noexcept;
147-
reference& operator=(const bool x) noexcept;
147+
reference& operator=(bool x) noexcept;
148148
reference& operator=(const reference& x) noexcept;
149149
iterator operator&() const noexcept;
150150
void flip() noexcept;

libcxx/src/string.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ get_swprintf()
423423
}
424424

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

libcxx/test/std/containers/associative/map/map.cons/copy_assign.pass.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ class counting_allocatorT {
4040
template <class U> bool operator==(const counting_allocatorT<U>& other) const noexcept { return foo == other.foo; }
4141
template <class U> bool operator!=(const counting_allocatorT<U>& other) const noexcept { return foo != other.foo; }
4242

43-
T * allocate(const size_t n) const {
43+
T* allocate(size_t n) const {
4444
ca_allocs.push_back(foo);
4545
void * const pv = ::malloc(n * sizeof(T));
4646
return static_cast<T *>(pv);
4747
}
48-
void deallocate(T * const p, size_t) const noexcept {
48+
void deallocate(T* p, size_t) const noexcept {
4949
ca_deallocs.push_back(foo);
5050
free(p);
5151
}
@@ -63,12 +63,12 @@ class counting_allocatorF {
6363
template <class U> bool operator==(const counting_allocatorF<U>& other) const noexcept { return foo == other.foo; }
6464
template <class U> bool operator!=(const counting_allocatorF<U>& other) const noexcept { return foo != other.foo; }
6565

66-
T * allocate(const size_t n) const {
66+
T* allocate(size_t n) const {
6767
ca_allocs.push_back(foo);
6868
void * const pv = ::malloc(n * sizeof(T));
6969
return static_cast<T *>(pv);
7070
}
71-
void deallocate(T * const p, size_t) const noexcept {
71+
void deallocate(T* p, size_t) const noexcept {
7272
ca_deallocs.push_back(foo);
7373
free(p);
7474
}

libcxx/test/std/strings/string.view/string.view.find/find_last_not_of_char_size.pass.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
// <string_view>
1010

11-
// const size_type find_last_not_of(charT c, size_type pos = npos) const;
11+
// size_type find_last_not_of(charT c, size_type pos = npos) const;
1212

1313
#include <string_view>
1414
#include <cassert>

0 commit comments

Comments
 (0)