On Saturday, 6 July 2013 at 15:38:45 UTC, Artur Skawina wrote:
Do you think this would be a problem /in practice/?

Yes. Honestly, lot of problems. I can easily imagine template function that modifies its argument in-place for a mutable qualifier and allocates a copy for an immutable one. Templates that introspect their parameter type to format some string. Different algorithms for processing mutable and immutable versions of same container.

And it is not just code breakage - you propose some magic instead of simple well-defined semantics and so far I don't even see the detailed description how new system should behave. Currently template body is defined only by its parameter set, your proposal changes that as far as I understand.

I think more reasonable approach is to define "inout" in template parameter specialization to mean "I don't care what it is, make it compiler error to rely on any behavior difference between them". Don't know what to do about mangling though. Will also most likely need to prohibit and direct reference to T.

It looks like extremely complex way to solve only one minor part of general problem (template bloat).

Reply via email to