From b45afd1cab18832fa0bbc7300c7e71853c962209 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 27 Sep 2022 21:15:03 +0200 Subject: [PATCH] util/StringBuffer: add `constexpr` --- src/util/StringBuffer.hxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/util/StringBuffer.hxx b/src/util/StringBuffer.hxx index fdb250287..5e4498aa8 100644 --- a/src/util/StringBuffer.hxx +++ b/src/util/StringBuffer.hxx @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 Max Kellermann + * Copyright 2010-2022 Max Kellermann * * 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]; }