You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Semantically it seems like StackTrace::operator[](size_t idx) is a const operation, since it is simply returning by value a Trace object constructed out of the current state of the stack traces, but it is not currently declared const.
This impedes some uses, the obvious ones being that you have to pass around a non-constStackTrace object to methods that might use [], but I ran into the case where a StackTrace member of another class couldn't be accessed with operator[] in a const function of the containing class.
The current (Linux) implementation of operator[] doesn't have any problem being declared const. Adding const should be a non-breaking change, although you couldn't rule out that some other implementation would want to make this a physically non-const operation (e.g., caching values, whatever) - but that's where mutable comes in.
The text was updated successfully, but these errors were encountered:
Semantically it seems like
StackTrace::operator[](size_t idx)
is aconst
operation, since it is simply returning by value aTrace
object constructed out of the current state of the stack traces, but it is not currently declaredconst
.This impedes some uses, the obvious ones being that you have to pass around a non-
const
StackTrace
object to methods that might use[]
, but I ran into the case where aStackTrace
member of another class couldn't be accessed withoperator[]
in aconst
function of the containing class.The current (Linux) implementation of
operator[]
doesn't have any problem being declaredconst
. Addingconst
should be a non-breaking change, although you couldn't rule out that some other implementation would want to make this a physically non-const
operation (e.g., caching values, whatever) - but that's wheremutable
comes in.The text was updated successfully, but these errors were encountered: