Skip to content

Commit

Permalink
src: disallow copy/move fns/constructors
Browse files Browse the repository at this point in the history
PR-URL: #56811
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Daniel Lemire <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
  • Loading branch information
anonrig authored Feb 10, 2025
1 parent 1781f63 commit 6ba36b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/debug_utils-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct ToStringHelper {
template <unsigned BASE_BITS,
typename T,
typename = std::enable_if_t<!std::is_integral_v<T>>>
static std::string BaseConvert(T value) {
static std::string BaseConvert(T& value) { // NOLINT(runtime/references)
return Convert(std::forward<T>(value));
}
};
Expand Down
5 changes: 5 additions & 0 deletions src/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@ constexpr size_t strsize(const T (&)[N]) {
template <typename T, size_t kStackStorageSize = 1024>
class MaybeStackBuffer {
public:
// Disallow copy constructor
MaybeStackBuffer(const MaybeStackBuffer&) = delete;
// Disallow copy assignment operator
MaybeStackBuffer& operator=(const MaybeStackBuffer& other) = delete;

const T* out() const {
return buf_;
}
Expand Down

0 comments on commit 6ba36b4

Please sign in to comment.