I'm using std.variant.Variant to hold a value of unknown type
(not a string, could be a numeric type or a container holding
multiple numeric types). I'm trying to retrieve this value with
.get!T but I need the type to do that... .type gives me TypeInfo,
but that's not a type so I'm not sure
On Saturday, 25 November 2017 at 10:08:36 UTC, vit wrote:
On Saturday, 25 November 2017 at 09:52:01 UTC, Chirs Forest
wrote:
[...]
import std.meta : staticMap;
class Bar(T) {
T bar;
}
class Foo(Ts...){
staticMap!(Bar, Ts) bars;
this(){
static foreach(i, alias T; Ts)
I'd like to make a class that takes multiple template types (1 -
several) which can hold an array/tuple of a second class that are
instantiated with those types.
class Bar(T) {
T bar;
}
class Foo(T[]){ // not sure how to take variadic types here?
Bar!(?)[] bars; //not sure how I'd
I'm interpolating some values and I need to make an
(elapsed_time/duration) value a float between 0 and 1 (inclusive
of 0 and 1). The elapsed_time might be more than the duration,
and in some cases might be 0 or less. What's the most efficient
way to cap out of bounds values to 0 and 1? I can
On Wednesday, 15 November 2017 at 13:30:14 UTC, Adam D. Ruppe
wrote:
On Wednesday, 15 November 2017 at 13:24:02 UTC, Chirs Forest
wrote:
class Audio {
Audio a;
writeln(); // 281478
is usually wrong. That's the address of the reference,
not of the actual object. You might want
I'm using the derelict fmod bindings to handle sounds in my
application and I'm running into a weird bug... If I put calls to
fmod in a function inside a class, upon calling those functions
the instance of that class will be null, or otherwise changed. I
obviously get an access violation if I
I keep having to make casts like the following and it's really
rubbing me the wrong way:
void foo(T)(T bar){...}
byte bar = 9;
foo!byte(bar + 1); //Error: function foo!byte.foo (byte bar) is
not callable using argument types (int)
foo!byte(cast(byte)(bar + 1));
It wouldn't be so bad if I
I have some data that I want to store in a dynamic 2d array...
I'd like to be able to add elements to the front of the array and
access those elements with negative integers as well as add
numbers to the back that I'd acess normally with positive
integers. Is this something I can do, or do I