You cannot have pointers to classes. The language does not
support it. You can
have pointers to class references, and you can have pointers to
structs or the
built-in types, but if Foo is a class, then what you can't have
a pointer to
it. The closest that you can get is that I believe that you c
On Monday, July 16, 2012 09:33:42 Namespace wrote:
> Yes. I want a Pointer of Foo's reference, you're right. I think i
> have to move the reference to the heap?
If you don't want it to point to a local variable and cause problems when it
goes out of scope, then yeah, though I don't know if it's p
I'm just experiement with D, that's all. ;)
Most of my questions here are just out of curiosity.
I have now this construct:
[code]
class smart_ptr {
private:
A* _ptr;
public:
this(A* ptr) {
void* buffer = GC.malloc(A.sizeof);
memcpy(buffer, ptr, A
On Monday, July 16, 2012 10:31:11 Namespace wrote:
> I'm just experiement with D, that's all. ;)
> Most of my questions here are just out of curiosity.
>
> I have now this construct:
>
> [code]
> class smart_ptr {
> private:
> A* _ptr;
>
> public:
> this(A* ptr) {
> voi
Having been around long enough to remember when the ability to
call "foo()" as "foo" first appeared, I feel it necessary to
point out that this was *not* in fact a deliberate design, but
rather a sort of "accident" that arose out of D's first attempt
at properties. It was the same "accident" l
On 13/07/12 12:52, Johannes Pfau wrote:
Am Fri, 13 Jul 2012 11:53:07 +0200
schrieb Don Clugston :
On 13/07/12 11:16, Johannes Pfau wrote:
Casting from void[] to ubyte[] is currently not allowed in CTFE. Is
there a special reason for this? I don't see how this cast can be
dangerous?
CTFE does
Hmm.. actually, it seems there have been plenty of reports of
this issue already. Didn't see it the first time:
http://d.puremagic.com/issues/show_bug.cgi?id=6174
16.07.2012 9:46, Mike Parker пишет:
On 7/16/2012 1:01 AM, Alexandr Druzhinin wrote:
15.07.2012 22:56, Alexandr Druzhinin пишет:
15.07.2012 22:33, Alex Rønne Petersen пишет:
test case:
class A {
}
__gshared A a;
void main(string[] args) {
a = new A;
}
every time after finishing applic
[DMD32 D Compiler v2.059]
Hello,
I was rewriting some code so some large data array was a separate
data file, and got an abnormal program termination, with the
error:
C:\D\dmd2\windows\bin\..\..\src\phobos\std\conv.d(2704): Error:
function std.conv.parse!(float[],string).parse compiler erro
On Monday, 16 July 2012 at 17:02:52 UTC, Lemonfiend wrote:
[DMD32 D Compiler v2.059]
Hello,
I was rewriting some code so some large data array was a
separate data file, and got an abnormal program termination,
with the error:
C:\D\dmd2\windows\bin\..\..\src\phobos\std\conv.d(2704): Error:
How do you make a (deep) copy of a variable of any type? For
example the following attempt at a generic next function doesn't
work, because it modifies its argument if the argument is a
reference type.
T next(T)(in T value)
if (is(typeof(++[T.init][0]) == T))
{
auto copy = cast(T) valu
On 2012-07-16 20:48, Tommi wrote:
How do you make a (deep) copy of a variable of any type?
One way would be to serialize a value and the deserialize it. Although
that would not be very efficient.
https://github.com/jacob-carlborg/orange
--
/Jacob Carlborg
On Monday, July 16, 2012 19:02:48 Lemonfiend wrote:
> According to the bugzilla referenced in the error this was fixed;
> perhaps not?
The commit date for the fix is after the release of 2.059, so presumably, it
works just fine with git master.
- Jonathan M Davis
On Monday, 16 July 2012 at 19:46:21 UTC, Jonathan M Davis wrote:
On Monday, July 16, 2012 19:02:48 Lemonfiend wrote:
According to the bugzilla referenced in the error this was
fixed;
perhaps not?
The commit date for the fix is after the release of 2.059, so
presumably, it
works just fine wi
On 07/16/2012 01:38 AM, Nick Gurrola wrote:
import std.stdio;
void main()
{
writeln(typeid(Test!int));
}
template Test(T...)
{
alias immutable(T[0]) Test;
}
This prints "int" instead of "immutable(int)" like I would expect. Is
this a bug, or is that what is supposed to happen?
This
On 07/16/2012 10:55 AM, Chris NS wrote:
Having been around long enough to remember when the ability to call
"foo()" as "foo" first appeared, I feel it necessary to point out that
this was *not* in fact a deliberate design, but rather a sort of
"accident" that arose out of D's first attempt at pro
I'm another who is /vehemently/ against the utter
idiocy that is the -property switch.
I wonder: if we had another poll, a recall election
if you will, how many people who said "yes" the
first time would change their minds now?
I betcha it'd be quite a few.
On Monday, 16 July 2012 at 23:13:54 UTC, Timon Gehr wrote:
On 07/16/2012 10:55 AM, Chris NS wrote:
Having been around long enough to remember when the ability to
call
"foo()" as "foo" first appeared, I feel it necessary to point
out that
this was *not* in fact a deliberate design, but rather a
This code strikes me as being a bug:
class MyBase(T)
{}
class MySubA : MyBase!MySubA
{}
class MySubB : MyBase!MySubB
{}
void main()
{}
but it compiles just fine. However, given the fact that MySubA isn't even
properly defined until its base class has been defined, I don't se
http://en.wikipedia.org/wiki/Curiously_recurring_template_pattern
On 7/16/2012 10:24 PM, Jonathan M Davis wrote:
> This code strikes me as being a bug:
>
>
> class MyBase(T)
> {}
>
> class MySubA : MyBase!MySubA
> {}
>
> class MySubB : MyBase!MySubB
> {}
>
> void main()
> {}
> ---
On 17-07-2012 07:24, Jonathan M Davis wrote:
This code strikes me as being a bug:
class MyBase(T)
{}
class MySubA : MyBase!MySubA
{}
class MySubB : MyBase!MySubB
{}
void main()
{}
but it compiles just fine. However, given the fact that MySubA isn't even
properly defined unt
On Tuesday, July 17, 2012 07:37:38 Alex Rønne Petersen wrote:
> (Not sure if MySubB was meant to demonstrate anything; it's effectively
> semantically equal to MySubA.)
It's a simplification of an example in this question:
http://stackoverflow.com/questions/11516066/d-inheriting-static-variables-
It is indeed supposed to work, and was actually touted as a
common and lauded example way back in the day. However, with the
advent of this-params for templates it seems less useful now
(once they've been through the ringer a little more at least).
I did use this-params to great effect in Zea
23 matches
Mail list logo