inout template parameter, or a solution to the templated container issue
deadalnix
deadalnix at gmail.com
Wed Jun 12 09:18:50 PDT 2013
I knew you'll have interesting feddback.
On Wednesday, 12 June 2013 at 15:33:13 UTC, Steven Schveighoffer
wrote:
> The one problem I see here is the case where you want to have
> Array mutate its data.
>
I admit that this won't solve the issue. But I don't know if this
is an issue to be fair.
> For example, let's say Array makes ptr and length private
> overloads opIndex AND opIndexAssign to prevent taking the the
> address of its data.
>
I'm not sure what is the use case. But that is clearly impossible
with the solution I proposed.
> Another issue here is, what if you don't want Array to be a
> template? That is, you want:
>
> struct IntArray {
> size_t length;
> int *ptr;
> }
>
> How do you make this tail-const-able?
>
By making it a template. I'm also not sure what is the use case
here, but still this is a limitation.
> It's a very good start, and very close to the solution I have.
> I'm going to finish my article and post it hopefully next week.
>
Could you give a quick executive summary ?
More information about the Digitalmars-d
mailing list