Does it make sense to return const objects by value?
Show answer and explanation
Usually no. Top-level const on a returned value gives the caller no durable protection and can inhibit moving in older or generic code. Return an ordinary value and let the caller decide whether its receiving object is const.
Usually no. Top-level const on a returned value gives the caller no durable protection and can inhibit moving in older or generic code. Return an ordinary value and let the caller decide whether its receiving object is const.
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.