Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #1710 (new defect)

Opened 15 years ago

Last modified 14 years ago

tango.core.Variant cannot unbox static arrays

Reported by: DRK Assigned to: DRK
Priority: major Milestone: 1.0
Component: Tango Version: 0.99.8 Sean
Keywords: Cc:

Description

Under normal circumstances, you can't put a static array inside a Variant: it will convert it to a dynamic array upon assignment.

The exception to this is when you do this:

T[N] a;
auto v = Variant(typeid(typeof(a)), &a);

Although it can convert the array contents, it cannot construct the TypeInfo? for T[]. Currently, this means the array is stored using the T[N] typeinfo.

However, this means that it can't actually be unboxed. Note that this does not affect Variant.toPtr or .toVarargs.

Resolution: Variant.get should learn how to recognise static arrays and unpack them as dynamic arrays (static arrays can't be returned from functions anyway).

Change History

07/23/09 09:45:10 changed by DRK

  • owner changed from kris to DRK.

02/07/10 21:41:39 changed by larsivi

  • milestone changed from 0.99.9 to 1.0.