On 02/01/2016 10:20 PM, Enjoys Math wrote:
class A {
}
class B : A {
}
class C : B {
}
auto b = new B();
typeid(b) == "B"
?
Thanks.
class A {
}
class B : A {
}
class C : B {
}
void main() {
auto b = new B();
assert(typeid(b) == typeid(B));
// Or, if you have the ty
class A {
}
class B : A {
}
class C : B {
}
auto b = new B();
typeid(b) == "B"
?
Thanks.
On Tuesday, 2 February 2016 at 03:36:25 UTC, Steven Schveighoffer
wrote:
S has 3 different properties, x, y, z:
struct S
{
int x;
int y() { return 1;}
}
int z(S s) { return 1;}
pragma(msg, typeof(S.init.x).stringof); // int
pragma(msg, typeof(S.init.y).stringof); // int()
pragma(msg, typ
On Monday, 1 February 2016 at 22:32:26 UTC, Steven Schveighoffer
wrote:
What I wanted essentially was a template constraint that says
"this type has a member named foo, and t.foo is an lvalue"
-Steve
Like this?
template hasLValProperty(T, string property) {
enum hasLValProperty = __trait
On Tuesday, 2 February 2016 at 03:22:16 UTC, Maeriden wrote:
Try aiGetMaterialTextureCount.
I'm guessing derelict uses the C API as much as it can.
It uses the C API exclusively.
S has 3 different properties, x, y, z:
struct S
{
int x;
int y() { return 1;}
}
int z(S s) { return 1;}
pragma(msg, typeof(S.init.x).stringof); // int
pragma(msg, typeof(S.init.y).stringof); // int()
pragma(msg, typeof(S.init.z).stringof); // int
Is there a trait I can call/use to consis
On Tuesday, 2 February 2016 at 02:57:14 UTC, WhatMeWorry wrote:
I'm porting a C++/opengl/AssImp tutorial over to
D/DerelictOpenGL/DerelictAssImp
but have hit a brick wall.
[...]
Try aiGetMaterialTextureCount.
I'm guessing derelict uses the C API as much as it can.
I'm porting a C++/opengl/AssImp tutorial over to
D/DerelictOpenGL/DerelictAssImp
but have hit a brick wall.
It's a fairly large project but a tiny fragment suffices:
if(mesh.mMaterialIndex >= 0)
{
const aiMaterial* material =
scene.mMaterials[mesh.mMaterialIndex];
// uint texCount =
m
On 2/1/16 8:17 PM, Enjoys Math wrote:
That is in metric system units?
Ie milli-, micro-, hectanano-, nano-seconds?
Those are available from SysTime.fracSecs.
Is that what you are looking for? If not, please be more specific. time
has a lot of different meanings.
-Steve
That is in metric system units?
Ie milli-, micro-, hectanano-, nano-seconds?
The documentation doesn't show this well and many things are
deprecated.
Please show me how!
Thank you.
On Monday, 1 February 2016 at 12:05:53 UTC, ref2401 wrote:
On Sunday, 31 January 2016 at 14:48:34 UTC, ref2401 wrote:
I am getting runtime error:
core.exception.AssertError@std\experimental\allocator\building_blocks\region.d(235): Assertion failure
At least tell me can anyone replicate it?
h
On 2/1/16 5:20 PM, tsbockman wrote:
On Sunday, 31 January 2016 at 22:11:45 UTC, Steven Schveighoffer wrote:
Thanks! I was surprised this is not straightforward.
-Steve
For function return values, at least, you can do this:
import std.traits, std.stdio;
int foo()
{
return 0;
}
ref int
On Sunday, 31 January 2016 at 22:11:45 UTC, Steven Schveighoffer
wrote:
Thanks! I was surprised this is not straightforward.
-Steve
For function return values, at least, you can do this:
import std.traits, std.stdio;
int foo()
{
return 0;
}
ref int bar()
{
static int x = 0;
retu
On Monday, 1 February 2016 at 20:53:35 UTC, Artur Skawina wrote:
On 02/01/16 21:42, Artur Skawina wrote:
On 02/01/16 20:47, Meta via Digitalmars-d-learn wrote:
That looks much nicer. It still needs work to properly handle
functions with non-empty argument lists.
Then it gets a bit long for a
On Monday, 1 February 2016 at 19:55:26 UTC, mark_mcs wrote:
On Monday, 1 February 2016 at 12:05:53 UTC, ref2401 wrote:
On Sunday, 31 January 2016 at 14:48:34 UTC, ref2401 wrote:
I am getting runtime error:
core.exception.AssertError@std\experimental\allocator\building_blocks\region.d(235): Asse
On Monday, 1 February 2016 at 21:40:45 UTC, Enjoys Math wrote:
module signals_and_slots;
import std.algorithm: remove;
[...]
D's signals & slots:
https://dlang.org/phobos/std_signals.html
module signals_and_slots;
import std.algorithm: remove;
struct Slots(DelegateType, ArgTypes...) {
this() {
}
// How would you implement this?
void call(ArgTypes args) {
foreach (dg; delegates)
dg(args);
}
On 02/01/16 21:42, Artur Skawina wrote:
> On 02/01/16 20:47, Meta via Digitalmars-d-learn wrote:
>> That looks much nicer. It still needs work to properly handle functions with
>> non-empty argument lists.
>
> Then it gets a bit long for a one-liner ;)
>
>enum isLvalue(A...) = is(typeof((ref
On 02/01/16 20:47, Meta via Digitalmars-d-learn wrote:
> On Monday, 1 February 2016 at 18:28:05 UTC, Artur Skawina wrote:
>> On 01/31/16 23:11, Steven Schveighoffer via Digitalmars-d-learn wrote:
>>> Thanks! I was surprised this is not straightforward.
>>
>>enum isLvalue(alias A) = is(typeof((r
For example it is no problem in C++ to have
std::vector> vuf;
But how can this be expressed in D?
For example
Array!(Unique!int) ua;
doesn't compile because it requires this(this) which is obviously
disabled for "Unique".
Sorry for late reply -- but I got around to test a couple more
cases!
On Monday, 1 February 2016 at 00:19:44 UTC, Nicholas Wilson wrote:
Unqaul means remove any const or immutable torn the type
Okay, that sounds like our 'const' shouldn't matter. 'const' is
the outermost qualifier, and strip
On 2/1/16 2:47 PM, Meta wrote:
On Monday, 1 February 2016 at 18:28:05 UTC, Artur Skawina wrote:
On 01/31/16 23:11, Steven Schveighoffer via Digitalmars-d-learn wrote:
Thanks! I was surprised this is not straightforward.
enum isLvalue(alias A) = is(typeof((ref _){}(A)));
artur
That looks
On Monday, 1 February 2016 at 12:05:53 UTC, ref2401 wrote:
On Sunday, 31 January 2016 at 14:48:34 UTC, ref2401 wrote:
I am getting runtime error:
core.exception.AssertError@std\experimental\allocator\building_blocks\region.d(235): Assertion failure
At least tell me can anyone replicate it?
R
On Monday, 1 February 2016 at 18:28:05 UTC, Artur Skawina wrote:
On 01/31/16 23:11, Steven Schveighoffer via Digitalmars-d-learn
wrote:
Thanks! I was surprised this is not straightforward.
enum isLvalue(alias A) = is(typeof((ref _){}(A)));
artur
That looks much nicer. It still needs work
On Monday, 1 February 2016 at 02:56:06 UTC, Tofu Ninja wrote:
Just out of curiosity, does anyone have an octree
implementation for D laying around? Just looking to save some
time.
https://github.com/Ingrater/thBase/blob/master/src/thBase/container/octree.d
Its a loose octree implementation. T
On 01/31/16 23:11, Steven Schveighoffer via Digitalmars-d-learn wrote:
> Thanks! I was surprised this is not straightforward.
enum isLvalue(alias A) = is(typeof((ref _){}(A)));
artur
On 1/31/16 5:12 PM, Meta wrote:
On Sunday, 31 January 2016 at 22:11:45 UTC, Steven Schveighoffer wrote:
On 1/31/16 4:48 PM, Meta wrote:
This seems to do the trick, although I haven't extensively tested it.
There's probably a simpler way but this is the first thing I could come
up with that wo
On Monday, 1 February 2016 at 12:05:53 UTC, ref2401 wrote:
On Sunday, 31 January 2016 at 14:48:34 UTC, ref2401 wrote:
I am getting runtime error:
core.exception.AssertError@std\experimental\allocator\building_blocks\region.d(235): Assertion failure
At least tell me can anyone replicate it?
M
On Monday, February 01, 2016 13:22:23 Daniel Kozak via Digitalmars-d-learn
wrote:
> V Mon, 01 Feb 2016 12:19:10 +
> Namal via Digitalmars-d-learn
> napsáno:
>
> > On Monday, 1 February 2016 at 12:12:00 UTC, Jonathan M Davis
> > wrote:
> > > On Monday, February 01, 2016 11:15:40 Namal via
> >
V Mon, 01 Feb 2016 12:19:10 +
Namal via Digitalmars-d-learn
napsáno:
> On Monday, 1 February 2016 at 12:12:00 UTC, Jonathan M Davis
> wrote:
> > On Monday, February 01, 2016 11:15:40 Namal via
> > Digitalmars-d-learn wrote:
> >> Sorry guys that I didn't express myself well. I also mixed
On Monday, 1 February 2016 at 12:12:00 UTC, Jonathan M Davis
wrote:
On Monday, February 01, 2016 11:15:40 Namal via
Digitalmars-d-learn wrote:
Sorry guys that I didn't express myself well. I also mixed
some stuff up. What I wanted to ask is this, in c++ this is
valid
int x = 3;
int y = 10
On Monday, February 01, 2016 11:15:40 Namal via Digitalmars-d-learn wrote:
> Sorry guys that I didn't express myself well. I also mixed some
> stuff up. What I wanted to ask is this, in c++ this is valid
>
> int x = 3;
> int y = 10;
> int arr [x][y];
>
> x,y are known at the compile time and
On Sunday, 31 January 2016 at 14:48:34 UTC, ref2401 wrote:
I am getting runtime error:
core.exception.AssertError@std\experimental\allocator\building_blocks\region.d(235): Assertion failure
At least tell me can anyone replicate it?
V Mon, 01 Feb 2016 11:15:40 +
Namal via Digitalmars-d-learn
napsáno:
> Sorry guys that I didn't express myself well. I also mixed some
> stuff up. What I wanted to ask is this, in c++ this is valid
>
> int x = 3;
> int y = 10;
> int arr [x][y];
>
> x,y are known at the co
Sorry guys that I didn't express myself well. I also mixed some
stuff up. What I wanted to ask is this, in c++ this is valid
int x = 3;
int y = 10;
int arr [x][y];
x,y are known at the compile time and arr is a static array. I
can't do that in D so what is the best way
On Monday, February 01, 2016 07:42:56 Namal via Digitalmars-d-learn wrote:
> On Monday, 1 February 2016 at 07:41:33 UTC, Namal wrote:
> > I understand that I cannot pass a variable to the static array
> > like in C++, and have to use dynamic arrays. But how can I set
> > the length for them without
On Sunday, 31 January 2016 at 02:58:28 UTC, Andrew Edwards wrote:
void notUsed(T)(T v) { return cast(void)0; };
since it always returns cast(void)0 regardless of the input.
But it cannot be that simple, so what am I missing?
Now notUsed has an unused parameter v.
37 matches
Mail list logo