How should you return const pointers from a function?
Show answer and explanation
Return a pointer-to-const, const T*, when the caller may observe but not mutate the pointee through that handle. Making the pointer value itself top-level const in a return type is discarded and does not constrain the caller.
Return a pointer-to-const, const T*, when the caller may observe but not mutate the pointee through that handle. Making the pointer value itself top-level const in a return type is discarded and does not constrain the caller.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.