util/StringBuffer: add `constexpr`
This commit is contained in:
parent
8b73257a86
commit
b45afd1cab
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2010-2018 Max Kellermann <max.kellermann@gmail.com>
|
||||
* Copyright 2010-2022 Max Kellermann <max.kellermann@gmail.com>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
|
@ -62,7 +62,7 @@ public:
|
|||
return front() == SENTINEL;
|
||||
}
|
||||
|
||||
void clear() noexcept {
|
||||
constexpr void clear() noexcept {
|
||||
the_data[0] = SENTINEL;
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public:
|
|||
return the_data.data();
|
||||
}
|
||||
|
||||
pointer data() noexcept {
|
||||
constexpr pointer data() noexcept {
|
||||
return the_data.data();
|
||||
}
|
||||
|
||||
|
@ -81,14 +81,14 @@ public:
|
|||
/**
|
||||
* Returns one character. No bounds checking.
|
||||
*/
|
||||
value_type operator[](size_type i) const noexcept {
|
||||
constexpr value_type operator[](size_type i) const noexcept {
|
||||
return the_data[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns one writable character. No bounds checking.
|
||||
*/
|
||||
reference operator[](size_type i) noexcept {
|
||||
constexpr reference operator[](size_type i) noexcept {
|
||||
return the_data[i];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue