digitalmars.D.learn - Convert std.container.array to void[] and/or pass to OpenGL functions
- ParticlePeter (6/6) Jun 17 2015 I use wrapper functions taking void[] arrays to forward them
- Alex Parrill (2/8) Jun 17 2015 Try slicing it: `array[]`
- ParticlePeter (4/12) Jun 17 2015 That gives me a range, which I could convert to an array with
- "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> (3/9) Jun 17 2015 Would this work?
- ParticlePeter (5/14) Jun 17 2015 Unfortunately not:
- Kagamin (1/1) Jun 17 2015 (&arr.front())[0 .. arr.length] ?
- ParticlePeter (2/3) Jun 17 2015 Yes, this works, nice, thanks :-)
I use wrapper functions taking void[] arrays to forward them comfortably to mentioned OpenGL functions. This works with static and dynamic build in arrays, but I don't see a way how I could access (cast) the raw data of a std.container.array to forward it to these wrapper functions. std.array(Range)(Range r) does a copy which I would like to avoid. Any advice ?
Jun 17 2015
On Wednesday, 17 June 2015 at 13:04:28 UTC, ParticlePeter wrote:I use wrapper functions taking void[] arrays to forward them comfortably to mentioned OpenGL functions. This works with static and dynamic build in arrays, but I don't see a way how I could access (cast) the raw data of a std.container.array to forward it to these wrapper functions. std.array(Range)(Range r) does a copy which I would like to avoid. Any advice ?Try slicing it: `array[]`
Jun 17 2015
On Wednesday, 17 June 2015 at 13:07:11 UTC, Alex Parrill wrote:On Wednesday, 17 June 2015 at 13:04:28 UTC, ParticlePeter wrote:That gives me a range, which I could convert to an array with std.array(Range)(Range r) which I want to avoid.I use wrapper functions taking void[] arrays to forward them comfortably to mentioned OpenGL functions. This works with static and dynamic build in arrays, but I don't see a way how I could access (cast) the raw data of a std.container.array to forward it to these wrapper functions. std.array(Range)(Range r) does a copy which I would like to avoid. Any advice ?Try slicing it: `array[]`
Jun 17 2015
On Wednesday, 17 June 2015 at 13:04:28 UTC, ParticlePeter wrote:I use wrapper functions taking void[] arrays to forward them comfortably to mentioned OpenGL functions. This works with static and dynamic build in arrays, but I don't see a way how I could access (cast) the raw data of a std.container.array to forward it to these wrapper functions. std.array(Range)(Range r) does a copy which I would like to avoid. Any advice ?Would this work? (&arr.front)[0 .. arr.length]
Jun 17 2015
On Wednesday, 17 June 2015 at 13:31:21 UTC, Marc Schütz wrote:On Wednesday, 17 June 2015 at 13:04:28 UTC, ParticlePeter wrote:Unfortunately not: Error: Vector!(float, 3) delegate() pure nothrow property ref safe cannot be sliced with [] Fyi, its an std.container.array!( gl3n.Vector!(float, 3) ) array.I use wrapper functions taking void[] arrays to forward them comfortably to mentioned OpenGL functions. This works with static and dynamic build in arrays, but I don't see a way how I could access (cast) the raw data of a std.container.array to forward it to these wrapper functions. std.array(Range)(Range r) does a copy which I would like to avoid. Any advice ?Would this work? (&arr.front)[0 .. arr.length]
Jun 17 2015
On Wednesday, 17 June 2015 at 13:58:09 UTC, Kagamin wrote:(&arr.front())[0 .. arr.length] ?Yes, this works, nice, thanks :-)
Jun 17 2015