On Friday, 26 August 2016 at 07:21:55 UTC, Daniel Kozak wrote:
Dne 26.8.2016 v 09:12 magicdmer via Digitalmars-d-learn can you
try it from console?
something like dmd.exe -m32mscoff your_d_file.d
same error , it's only dll project like this. console project can
build successfully with
the "MS-
Dne 26.8.2016 v 09:12 magicdmer via Digitalmars-d-learn napsal(a):
On Friday, 26 August 2016 at 07:00:37 UTC, rikki cattermole wrote:
Okay so your Windows language is non-english, that'll be it.
You need to be looking into the encoding that Visual Studio is using
for you files. Something to do
On Friday, 26 August 2016 at 07:00:37 UTC, rikki cattermole wrote:
Okay so your Windows language is non-english, that'll be it.
You need to be looking into the encoding that Visual Studio is
using for you files. Something to do with the BOM or hasn't
even been set to utf-8 isn't quite right.
, and select the "Use
MS-COFF object file fromat for win32" . when i build it ,it display
the error follow ,look at the picture
I use dmd 2.071.1
https://s14.postimg.org/a4wcv74ct/image.png
sorry,i post wrong url,look follow url, can you tell me how to modify
the thread
https:/
se
MS-COFF object file fromat for win32" . when i build it ,it display
the error follow ,look at the picture
I use dmd 2.071.1
https://s14.postimg.org/a4wcv74ct/image.png
sorry,i post wrong url,look follow url, can you tell me how to modify
the thread
https://s14.postimg.io/cyzi8n6j5/image.png
On Friday, 26 August 2016 at 06:38:01 UTC, Daniel Kozak wrote:
That image is too small, so I can't see it :)
Dne 26.8.2016 v 08:26 magicdmer via Digitalmars-d-learn
napsal(a):
I use VisualD create a windows dll project , and select the
"Use MS-COFF object file fromat for win32"
That image is too small, so I can't see it :)
Dne 26.8.2016 v 08:26 magicdmer via Digitalmars-d-learn napsal(a):
I use VisualD create a windows dll project , and select the "Use
MS-COFF object file fromat for win32" . when i build it ,it display
the error follow ,look at the
I use VisualD create a windows dll project , and select the "Use
MS-COFF object file fromat for win32" . when i build it ,it
display the error follow ,look at the picture
I use dmd 2.071.1
https://s14.postimg.org/a4wcv74ct/image.png
On Thursday, 11 August 2016 at 20:27:51 UTC, Michael Coulombe
wrote:
here is something for you to play with:
import std.stdio;
enum CallAllowed0;
enum CallAllowed1;
struct S {
@CallAllowed0 void foo () { writeln("foo()"); }
@CallAllowed1 void foo (int n) { writeln("foo(", n, ")"); }
}
On Thursday, 11 August 2016 at 20:41:33 UTC, ketmar wrote:
ah, my bad, i missed UDA part of the question. sorry. ;-)
On Thursday, 11 August 2016 at 20:27:51 UTC, Michael Coulombe
wrote:
import std.stdio;
struct S {
void foo () { writeln("foo()"); }
void foo (int n) { writeln("foo(", n, ")"); }
}
auto doit(string methodName, C, Args...) (C c, Args args) {
static if (is(typeof(mixin("c."~methodName~"(a
On Thursday, 11 August 2016 at 20:27:51 UTC, Michael Coulombe
wrote:
Is there a way to implement "getSymbolOfCall" and
"getDelegateOfCall" such that doit is functionally equivalent
to calling the method directly?
auto doit(C, string methodName, Args...)(C c, Args args) {
alias methodSymbol
Is there a way to implement "getSymbolOfCall" and
"getDelegateOfCall" such that doit is functionally equivalent to
calling the method directly?
auto doit(C, string methodName, Args...)(C c, Args args) {
alias methodSymbol = getSymbolOfCall!(c, methodName, Args);
pragma(msg, hasUDA!(meth
'not callable
using a mutable object'. Even marking a string with the
immutable keyword has the same result.
auto s = new immutable(Boxed!string)(`foo`);
what it's saying is that the box itself needs to be immutable.
Honestly I don't know why it was even possible to make a
On Friday, 29 July 2016 at 20:25:16 UTC, Cauterite wrote:
On Friday, 29 July 2016 at 20:13:34 UTC, stunaep wrote:
I have some java code I need to convert and at one point it
uses an Object[] array to store various ints, longs, and
strings. Java has built in Integer and Long classes that wrap
.html#.Algebraic
>>
>> Ali
>
> It could work, but keep in mind Algebraic is a structure, not an object.
Also, I've later noticed that your Box was a class, so it would allow
"arrays of mixed primitive types" as well.
Yes, Algebraic is not a struct but Java not
an
object.
On 07/29/2016 01:25 PM, Cauterite wrote:
On Friday, 29 July 2016 at 20:13:34 UTC, stunaep wrote:
I have some java code I need to convert and at one point it uses an
Object[] array to store various ints, longs, and strings. Java has
built in Integer and Long classes that wrap the primitives in
On Friday, 29 July 2016 at 20:13:34 UTC, stunaep wrote:
I have some java code I need to convert and at one point it
uses an Object[] array to store various ints, longs, and
strings. Java has built in Integer and Long classes that wrap
the primitives in an object and strings are already objects
I have some java code I need to convert and at one point it uses
an Object[] array to store various ints, longs, and strings. Java
has built in Integer and Long classes that wrap the primitives in
an object and strings are already objects.
Ahh I see, thanks guys.
On 7/25/16 5:54 AM, Kagamin wrote:
Cast it to Object:
FooInterface a = new BarImplementsInterface();
FooBaseClass b = new BarDerivedClass();
Object o = cast(Object)a;
writefln("a class: %s", a.classinfo.name);
writefln("b class: %s", b.classinfo.name);
yep, cast it. without the cast, compiler assuming that it knows
the type in runtime, and is using well-known classinfo address
instead of really looking into instance for that.
Cast it to Object:
FooInterface a = new BarImplementsInterface();
FooBaseClass b = new BarDerivedClass();
Object o = cast(Object)a;
writefln("a class: %s", a.classinfo.name);
writefln("b class: %s", b.classinfo.name);
w
I'm having trouble getting the full name of an object of a class
that implements an interface, using typeid() or .classinfo, the
behavior seems to be different from that of a class that simply
derives other classes.
interface FooInterface {}
class BarImplementsInterface : FooInte
On 6/30/16 8:30 AM, jj75607 wrote:
On Thursday, 30 June 2016 at 12:21:03 UTC, Steven Schveighoffer wrote:
On 6/30/16 6:26 AM, jj75607 wrote:
Hello!
I need to overload opEquals on shared class C
shared class C
{
override bool opEquals(Object o) { return false; }
}
But compilation fails
On Thursday, 30 June 2016 at 12:21:03 UTC, Steven Schveighoffer
wrote:
On 6/30/16 6:26 AM, jj75607 wrote:
Hello!
I need to overload opEquals on shared class C
shared class C
{
override bool opEquals(Object o) { return false; }
}
But compilation fails with the message:
Error: function
On 6/30/16 6:26 AM, jj75607 wrote:
Hello!
I need to overload opEquals on shared class C
shared class C
{
override bool opEquals(Object o) { return false; }
}
But compilation fails with the message:
Error: function f700.C.opEquals does not override any function, did you
mean to override
Hello!
I need to overload opEquals on shared class C
shared class C
{
override bool opEquals(Object o) { return false; }
}
But compilation fails with the message:
Error: function f700.C.opEquals does not override any function,
did you mean to override 'object.Object.opEquals'?
On Wednesday, 15 June 2016 at 14:14:23 UTC, Seb wrote:
```
T[] a = slice.ptr[0.. slice.elementsCount];
```
This would work only for slices with continuous memory
representation and positive strides. -- Ilya
On Wednesday, 15 June 2016 at 14:14:23 UTC, Seb wrote:
On Wednesday, 15 June 2016 at 13:13:05 UTC, data pulverizer
And where can I find more cool tricks like that?
Browse the source code and the unittests. Phobos is an amazing
resource :)
Very true!
That's great many thanks!
On Wednesday, 15 June 2016 at 13:13:05 UTC, data pulverizer wrote:
On Wednesday, 15 June 2016 at 12:10:32 UTC, Seb wrote:
As said you can avoid the copy (see below). I also profiled it
a bit and it was interesting to see that 50% of the runtime
are spent on generating the random matrix. On my m
Oh, I didn't see that runif now returns a tuple.
On Wednesday, 15 June 2016 at 12:10:32 UTC, Seb wrote:
As said you can avoid the copy (see below). I also profiled it
a bit and it was interesting to see that 50% of the runtime are
spent on generating the random matrix. On my machine now both
scripts take 1.5s when compiled with
I didn't ben
On Wednesday, 15 June 2016 at 11:19:20 UTC, data pulverizer wrote:
On Wednesday, 15 June 2016 at 09:32:21 UTC, Andrea Fontana
wrote:
Then I think the slice.byElement.array is the right solution.
The problem with that is that it slows down the code. I
compared matrix multiplication between R a
On Wednesday, 15 June 2016 at 09:32:21 UTC, Andrea Fontana wrote:
Then I think the slice.byElement.array is the right solution.
The problem with that is that it slows down the code. I compared
matrix multiplication between R and D's cblas adaptor and ndslice.
n = 4000
Matrices: A, B
Sizes: b
On Wednesday, 15 June 2016 at 08:56:15 UTC, data pulverizer wrote:
On Wednesday, 15 June 2016 at 08:53:22 UTC, Andrea Fontana
wrote:
On Wednesday, 15 June 2016 at 08:25:35 UTC, data pulverizer
wrote:
I guess foreach would not copy the elements? for example:
foreach(el; slice.byElement)
On Wednesday, 15 June 2016 at 08:53:22 UTC, Andrea Fontana wrote:
On Wednesday, 15 June 2016 at 08:25:35 UTC, data pulverizer
wrote:
I guess foreach would not copy the elements? for example:
foreach(el; slice.byElement)
x ~= el;
But it feels wrong to be doing work pulling eleme
On Wednesday, 15 June 2016 at 08:25:35 UTC, data pulverizer wrote:
I guess foreach would not copy the elements? for example:
foreach(el; slice.byElement)
x ~= el;
But it feels wrong to be doing work pulling elements that
already exists by using foreach. I feel as if I am missin
On Wednesday, 15 June 2016 at 07:45:12 UTC, Andrea Fontana wrote:
On Wednesday, 15 June 2016 at 07:24:23 UTC, data pulverizer
wrote:
On Wednesday, 15 June 2016 at 03:17:39 UTC, Seb wrote:
On Wednesday, 15 June 2016 at 03:11:23 UTC, data pulverizer
wrote:
in that case:
import std.array : array
On Wednesday, 15 June 2016 at 07:24:23 UTC, data pulverizer wrote:
On Wednesday, 15 June 2016 at 03:17:39 UTC, Seb wrote:
On Wednesday, 15 June 2016 at 03:11:23 UTC, data pulverizer
wrote:
in that case:
import std.array : array;
int[] x = slice.byElement.array;
Are you sure you want to creat
On Wednesday, 15 June 2016 at 03:17:39 UTC, Seb wrote:
On Wednesday, 15 June 2016 at 03:11:23 UTC, data pulverizer
wrote:
in that case:
import std.array : array;
int[] x = slice.byElement.array;
Are you sure you want to create a _copy_ of your data? In most
cases you don't need that ;-)
t
On Wednesday, 15 June 2016 at 03:11:23 UTC, data pulverizer wrote:
in that case:
import std.array : array;
int[] x = slice.byElement.array;
Are you sure you want to create a _copy_ of your data? In most
cases you don't need that ;-)
thanks, now I can go to bed!
You are welcome. Sleep tig
On Wednesday, 15 June 2016 at 02:50:30 UTC, Seb wrote:
On Wednesday, 15 June 2016 at 02:43:37 UTC, data pulverizer
wrote:
How do I unravel a sliced item T[].sliced(...) to an array T[]?
For instance:
import std.experimental.ndslice;
auto slice = new int[12].sliced(3, 4);
int[] x = ??;
Thanks
On Wednesday, 15 June 2016 at 02:43:37 UTC, data pulverizer wrote:
How do I unravel a sliced item T[].sliced(...) to an array T[]?
For instance:
import std.experimental.ndslice;
auto slice = new int[12].sliced(3, 4);
int[] x = ??;
Thanks
A slice is just a _view_ on your memory, the easiest w
How do I unravel a sliced item T[].sliced(...) to an array T[]?
For instance:
import std.experimental.ndslice;
auto slice = new int[12].sliced(3, 4);
int[] x = ??;
Thanks
On Monday, 6 June 2016 at 21:55:00 UTC, ag0aep6g wrote:
On 06/06/2016 11:25 PM, Alex Parrill wrote:
You might be able to get away with casting the const away, if
you are
sure it won't modify the hash or equality check.
Casting away const and then mutating has undefined behavior.
The compiler
On 06/06/2016 11:25 PM, Alex Parrill wrote:
You might be able to get away with casting the const away, if you are
sure it won't modify the hash or equality check.
Casting away const and then mutating has undefined behavior. The
compiler is free to assume that it doesn't happen.
Be aware that
On Monday, 6 June 2016 at 21:25:16 UTC, Alex Parrill wrote:
On Monday, 6 June 2016 at 21:16:18 UTC, Begah wrote:
Does the key of a associative array will be const if the
reference is requested?
That's probably what it is, actually. Modifying the key with
the ref could cause the hash of the ke
On Monday, 6 June 2016 at 21:16:18 UTC, Begah wrote:
Does the key of a associative array will be const if the
reference is requested?
That's probably what it is, actually. Modifying the key with the
ref could cause the hash of the key to change without the
hashtable knowing about it, causing
On Monday, 6 June 2016 at 21:09:41 UTC, Alex Parrill wrote:
On Monday, 6 June 2016 at 20:40:12 UTC, Begah wrote:
I have a pretty weird error : Error: mutable method
isolated.graphics.g3d.model.Model.begin is not callable using
a const object
[...]
It may infer const from the type of
On Monday, 6 June 2016 at 20:40:12 UTC, Begah wrote:
I have a pretty weird error : Error: mutable method
isolated.graphics.g3d.model.Model.begin is not callable using a
const object
[...]
It may infer const from the type of `this.instance`, which may be
further modified if the method you
I have a pretty weird error : Error: mutable method
isolated.graphics.g3d.model.Model.begin is not callable using a
const object
The weird part is that i do not use const or immutable objects in
my code ( for the Model ) :
struct Handle {
Model *asset = null;
string
On Sunday, 29 May 2016 at 05:43:31 UTC, Mike Parker wrote:
On Sunday, 29 May 2016 at 05:35:33 UTC, Mike Parker wrote:
Well then, this completely breaks my understanding of variable
scope.
OK, I see now at [1] the following:
" Immutable data doesn't have synchronization problems, so the
comp
On Sunday, 29 May 2016 at 06:49:42 UTC, chmike wrote:
What is the right way to use it ?
I answer to my self after testing so that people looking for that
info can find it here.
The right way would be
immutable Category category_;
Rebindable!(immutable Category) instance() { return
On Saturday, 28 May 2016 at 21:21:34 UTC, ag0aep6g wrote:
On 05/28/2016 09:54 PM, chmike wrote:
The only inconvenience left is that we can't have mutable
references
to immutable objects.
There is std.typecons.Rebindable for that.
That would be a good news. What is the right way to use it ?
On Sunday, 29 May 2016 at 05:35:33 UTC, Mike Parker wrote:
Well then, this completely breaks my understanding of variable
scope.
OK, I see now at [1] the following:
" Immutable data doesn't have synchronization problems, so the
compiler doesn't place it in TLS."
I've read that page more th
On Saturday, 28 May 2016 at 15:39:44 UTC, ag0aep6g wrote:
On 05/28/2016 10:34 AM, Mike Parker wrote:
On Saturday, 28 May 2016 at 05:30:26 UTC, chmike wrote:
[...]
Is a static const Category c variable a TLS variable ?
Yes. All variables are TLS unless explicitly marked with
__gshared or
sh
On 05/28/2016 09:54 PM, chmike wrote:
The only inconvenience left is that we can't have mutable references
to immutable objects.
There is std.typecons.Rebindable for that.
On Friday, 27 May 2016 at 20:20:36 UTC, chmike wrote:
I need to create an app wide singleton instance for my class.
The singleton is immutable, but I want to allow mutable
references to that singleton object so that I can do fast 'is'
tests.
I declared this
class Category
{
instances where in fact objects with the same state
(member variable value) are the same instance.
Since with play a trick with the users assumption, there is a
high risk that user produces logically invalid code when using
synchronization with such a flyweight object.
In order to avoid this
On 05/28/2016 06:09 PM, chmike wrote:
In the following instruction of the above commit, what effect has the []
after init ?
_store[0 .. __traits(classInstanceSize, T)] = typeid(T).init[];
T is a template argument that is a class derived from Error.
I couldn't find an explanation here
https:/
variable value) are the same instance.
Since with play a trick with the users assumption, there is a
high risk that user produces logically invalid code when using
synchronization with such a flyweight object.
In order to avoid this problem I would need a solution to make
synchronization
On Saturday, 28 May 2016 at 08:47:48 UTC, Kagamin wrote:
For a trick of static mutable allocation see
https://github.com/dlang/druntime/pull/1325
In the following instruction of the above commit, what effect has
the [] after init ?
_store[0 .. __traits(classInstanceSize, T)] = typeid(T).ini
On 05/28/2016 10:34 AM, Mike Parker wrote:
On Saturday, 28 May 2016 at 05:30:26 UTC, chmike wrote:
[...]
Is a static const Category c variable a TLS variable ?
Yes. All variables are TLS unless explicitly marked with __gshared or
shared.
I don't think that's true.
import core.thread;
On Saturday, 28 May 2016 at 08:47:48 UTC, Kagamin wrote:
For a trick of static mutable allocation see
https://github.com/dlang/druntime/pull/1325
Thank you that looks promising. I'll study an experiment with the
code.
If I would like that the instances are not in TLS, can I use the
following
On Saturday, 28 May 2016 at 05:30:26 UTC, chmike wrote:
Would it be different if the object was declared const instead
of immutable ?
Sometimes compiler is able to figure out that const data is
immutable.
This is a bit frustrating because it is trivial to implement in
C and C++.
For a
On Saturday, 28 May 2016 at 08:34:17 UTC, Mike Parker wrote:
const(F) cf = f;
immutable(f) if = f;
And, of course, those should be const(Foo) and immutable(Foo).
On Saturday, 28 May 2016 at 05:30:26 UTC, chmike wrote:
What is the difference between a const and immutable object ?
would a const object be allowed to modify itself by using a
hash table or caching results inside ?
The difference lies in the guarantees of const and immutable.
Foo f = new
On Friday, 27 May 2016 at 21:41:02 UTC, Kagamin wrote:
On Friday, 27 May 2016 at 20:20:36 UTC, chmike wrote:
Is this code valid D or is the behavior undefined due to the
cast ?
A mutable object can be synchronized on:
synchronized(Category.instance){}
This will create and store a mutex in the
On Friday, 27 May 2016 at 20:20:36 UTC, chmike wrote:
The public interface of Category is designed so that the
object's state can't be modified and thus remains immutable.
Then... why cast away immutable?
I suppose there's always a core set of variables that are what
the
On Friday, 27 May 2016 at 20:20:36 UTC, chmike wrote:
Is this code valid D or is the behavior undefined due to the
cast ?
A mutable object can be synchronized on:
synchronized(Category.instance){}
This will create and store a mutex in the object (sad but true,
design taken from java). If the
On 5/27/16 4:20 PM, chmike wrote:
I need to create an app wide singleton instance for my class.
The singleton is immutable, but I want to allow mutable references to
that singleton object so that I can do fast 'is' tests.
I declared this
class Category
{
protected static
I need to create an app wide singleton instance for my class.
The singleton is immutable, but I want to allow mutable
references to that singleton object so that I can do fast 'is'
tests.
I declared this
class Category
{
protected static immutable Category instance_ = ne
import std.signals;
import std.stdio;
class hh
{
mixin Signal!();
void haha(){emit();}
}
class ff
{
void show()
{
writeln("ff show");
}
}
void main()
{
auto h = new hh();
void show()
{
writeln("main show");
}
auto f = new ff();
On Wednesday, 20 April 2016 at 12:32:48 UTC, Tofu Ninja wrote:
Is there a way to shallow copy an object when the type is
known? I cant seem to figure out if there is a standard way. I
can't just implement a copy function for the class, I need a
generic solution.
extern (C) Object _d_new
On Wednesday, 20 April 2016 at 19:58:15 UTC, Tofu Ninja wrote:
How does D not have shallow copy? Seems like a very basic
functionality...
You could implement a `dup()` method. `dup` is already used for
shallow copying of arrays, why not reuse it for classes (as a
convention)?
On Wednesday, 20 April 2016 at 19:58:15 UTC, Tofu Ninja wrote:
To implement a copy/paste/duplicate functionality in a game
editor. I have an entity-component system, to duplicate an
entity, all it's components need to be duplicated. I have many
many components, I don't want to rely on manually
On Wednesday, 20 April 2016 at 18:48:58 UTC, Alex Parrill wrote:
On Wednesday, 20 April 2016 at 12:32:48 UTC, Tofu Ninja wrote:
Is there a way to shallow copy an object when the type is
known? I cant seem to figure out if there is a standard way. I
can't just implement a copy function fo
On Wednesday, 20 April 2016 at 12:32:48 UTC, Tofu Ninja wrote:
Is there a way to shallow copy an object when the type is
known? I cant seem to figure out if there is a standard way. I
can't just implement a copy function for the class, I need a
generic solution.
A generic class copy fun
On Wednesday, 20 April 2016 at 12:32:48 UTC, Tofu Ninja wrote:
Is there a way to shallow copy an object when the type is
known? I cant seem to figure out if there is a standard way. I
can't just implement a copy function for the class, I need a
generic solution.
I feel like
Is there a way to shallow copy an object when the type is known?
I cant seem to figure out if there is a standard way. I can't
just implement a copy function for the class, I need a generic
solution.
On Sunday, 13 March 2016 at 16:16:55 UTC, MGW wrote:
void* thisAddr = cast(void*) &this;
This doesn't really make sense anyway, this is a local variable,
you want to do cast(void*) this in a class if you need the
address (which btw, you shouldn't actually, the reference itself
ought to be en
On Sunday, 13 March 2016 at 16:02:07 UTC, WebFreak001 wrote:
However note that this is not the same as that function.
cast(void*)this and &this are 2 different things. So if you
want to do the same as saveThis just do void* thisAddr =
cast(void*) &this; instead
void* thisAddr = cast(void*) &t
On Sunday, 13 March 2016 at 15:43:02 UTC, MGW wrote:
Cfoo foo = new Cfoo(); foo.saveThis(&foo);
However note that this is not the same as that function.
cast(void*)this and &this are 2 different things. So if you want
to do the same as saveThis just do void* thisAddr = cast(void*)
&this; ins
On Sunday, 13 March 2016 at 15:49:20 UTC, WebFreak001 wrote:
On Sunday, 13 March 2016 at 15:43:02 UTC, MGW wrote:
I want to get address of object Cfoo in constructor. Whether
it is possible?
class Cfoo {
void* adrThis;
this() {
adrThis = cast(void*) this
On Sunday, 13 March 2016 at 15:43:02 UTC, MGW wrote:
I want to get address of object Cfoo in constructor. Whether it
is possible?
class Cfoo {
void* adrThis;
this() {
adrThis = cast(void*) this;
}
}
...
Cfoo foo = new Cfoo();
"this" should
I want to get address of object Cfoo in constructor. Whether it
is possible?
now:
-
class Cfoo {
void* adrThis;
void saveThis(void* adr) { adrThis = adr; }
}
...
Cfoo foo = new Cfoo(); foo.saveThis(&foo);
shall be
--
class Cfoo {
On Monday, 8 February 2016 at 22:46:06 UTC, cy wrote:
On Monday, 8 February 2016 at 22:38:45 UTC, Mengu wrote:
i believe you can use __traits(getMember) there.
Great! Should have refreshed before sending that reply...
I wonder if mixin("a."~member) is better or worse than
__traits(getMember,
On Monday, 8 February 2016 at 22:46:06 UTC, cy wrote:
On Monday, 8 February 2016 at 22:38:45 UTC, Mengu wrote:
i believe you can use __traits(getMember) there.
Great! Should have refreshed before sending that reply...
I wonder if mixin("a."~member) is better or worse than
__traits(getMember,
On Monday, 8 February 2016 at 22:38:45 UTC, Mengu wrote:
i believe you can use __traits(getMember) there.
Great! Should have refreshed before sending that reply...
I wonder if mixin("a."~member) is better or worse than
__traits(getMember,a,member)...
xin("a."~D3);
}
}
void main() {
import std.stdio;
A a = {"north","south","east","west"};
writeln(goPlaces!("up","left","down")(a));
writeln(a.left);
}
top postin
On Monday, 8 February 2016 at 21:09:47 UTC, cy wrote:
object.member lets me access the member of the object, but what
if I want to access those members in a generic way, but in a
different arrangement depending on context? Like if I wanted to
first follow a tree down, and second priority would
object.member lets me access the member of the object, but what
if I want to access those members in a generic way, but in a
different arrangement depending on context? Like if I wanted to
first follow a tree down, and second priority would be going left
to right, but then I wanted to first go
On Thursday, 4 February 2016 at 05:51:22 UTC, Enjoys Math wrote:
Consider:
class C {
}
class B : C {
}
class A : B {
}
class D : C {
}
C[] objList;
how do we test if objLis[k] is of base type "B"?
Ie for [new A(), new B(), new D(), new C()] would give output
[true, true, false, false]
Consider:
class C {
}
class B : C {
}
class A : B {
}
class D : C {
}
C[] objList;
how do we test if objLis[k] is of base type "B"?
Ie for [new A(), new B(), new D(), new C()] would give output
[true, true, false, false].
?
Thank you! :D
T[] list;
foreach(v; list) {
if (SpecialT v2 = cast(SpecialT)v) {
writeln(v2);
} else {
writeln("err");
}
}
That should work.
my dmd source tree:
v2.070.0-b2
So where is the /official/ home for D object serialization?
Thanks.
Give http://code.dlang.org/packages/cerealed a try.
I'm not looking for anything advanced, just serialization of some
of my own types (classes & structs).
I've seen:
http://wiki.dlang.org/Review/std.serialization
However, I don't see std.serialization in my dmd source tree:
v2.070.0-b2
So where is the /official/ home for D o
a literal, using the
> deprecated way or the "lazy" way.
Which works out to one way that actually has the behavior that Andrea
needs, and that involves parsing javascript. That's not ideal.
Vibe.d has a static method 'emptyObject' that returns a new empty object.
That would be handy here.
601 - 700 of 1502 matches
Mail list logo