On Saturday, 16 April 2016 at 00:03:59 UTC, Jonathan M Davis
wrote:
On Friday, April 15, 2016 20:52:42 WebFreak001 via
Digitalmars-d-learn wrote:
void assertf(string file = __FILE__, size_t line = __LINE__,
Args...)(lazy bool condition, in string message, Args args) {
Yes, you can do that,
On Tuesday, 29 March 2016 at 10:13:28 UTC, Puming wrote:
Hi,
I'm writing a generic class:
```d
struct Message { ... }
class Decoder(MsgSrc) {
}
```
When using it, I'd have to include the type of its argument:
```
void main() {
Message[] src = ...;
auto decoder = new
On Wednesday, 23 March 2016 at 18:10:05 UTC, ParticlePeter wrote:
Thanks Simen,
your tokenCounter is inspirational, for the rest I'll take some
time for testing.
My pleasure. :) Testing it on your example data shows it to work
there. However, as stated above, the documentation says it's
On Wednesday, 23 March 2016 at 11:57:49 UTC, ParticlePeter wrote:
I need to parse an ascii with multiple tokens. The tokens can
be seen as keys. After every token there is a bunch of lines
belonging to that token, the values.
The order of tokens is unknown.
I would like to read the file in as
On Saturday, 19 March 2016 at 17:40:27 UTC, Lass Safin wrote:
Why:
enum Base {
A,
B,
}
enum Derived : Base {
C, // Gives error, says it can't implicitly convert
expression to Base.
D = 1, // Same error
E = cast(Base)294, // Finally works. Can only be
cast(Derived)
On Friday, 24 October 2014 at 00:21:52 UTC, Etienne Cimon wrote:
On 2014-10-23 20:12, bearophile wrote:
In D all class instances contain a pointer to the class and a
monitor
pointer. The table is used for run-time reflection, and for
standard
virtual methods like toString, etc.
Bye,
On 2013-10-16, 18:54, Daniel Davidson wrote:
On Thursday, 13 June 2013 at 12:29:57 UTC, Simen Kjaeraas wrote:
On Thu, 13 Jun 2013 14:17:22 +0200, Stephan Schiffels
stephan_schiff...@mac.com wrote:
For example, is there a way of instantiating an object normally (i.e.
mutable
On 2013-10-10, 19:23, H. S. Teoh wrote:
I have a template used for storing compile-time values:
template Def(int x, string y) {
alias impl = TypeTuple!(x,y);
}
How do I define a template isDef that, given some template alias A,
evaluates to true if A is some
On 2013-10-10, 16:04, bearophile wrote:
dominic jones:
I want to fill an array with random numbers without resorting to loops,
i.e. by doing something like the following, if it were possible:
fill!(function double(){ return uniform(0.0, 1.0);})(x[]);
Is there a simple way of doing this?
On Tue, 10 Sep 2013 02:28:24 +0200, Andrei Alexandrescu
seewebsiteforem...@erdani.org wrote:
On 9/9/13 12:47 PM, H. S. Teoh wrote:
On Mon, Sep 09, 2013 at 09:37:07PM +0200, Namespace wrote:
It's been a while since Manu convinced Walter and Andrei to
introduce a virtual Keyword and to change
On 2013-08-29, 10:25, Jonathan M Davis wrote:
On Thursday, August 29, 2013 10:07:31 Paul Jurczak wrote:
On Thursday, 29 August 2013 at 07:51:40 UTC, Jonathan M Davis
wrote:
[..]
as any integral value in a float will fit in an
int.
[..]
Will it? Most of them will not fit
Sure, they will.
On 2013-08-11, 20:33, JS wrote:
I think you're missing the point to some degree(I realize there is a
diff between an object and a type, but I should be able to easily get
the class size of an object at run time regardless if the object is
typed as a base class). The code below does this,
On 2013-07-15, 11:32, Larry wrote:
Hello,
I read the library reference for regex.
I really miss python's equivalent of finditer.
Sometimes matching is not on purpose and one will want to match all the
occurences to iterate over it since it is much more regarding concerning
the orders and
On 2013-07-14, 07:00, JS wrote:
I need to conditionally inherit:
interface A(T) : conditionallyInherit!(isBasicType!T, B);
A!(double) will inherit B but A!(mytype) won't.
template conditionallyInherit(bool choice, T...) {
static if (choice) {
alias conditionallyInherit = T;
On 2013-07-14, 07:40, JS wrote:
On Sunday, 14 July 2013 at 05:30:57 UTC, lomereiter wrote:
On Sunday, 14 July 2013 at 05:04:37 UTC, JS wrote:
and while I'm at it I need to conditionally constrain types.
interface A(T) where(!isBasicType!T, (T : B));
which is suppose to require T to inherit
On 2013-07-11, 20:22, Namespace wrote:
What should he do?
As far as I can see he has 3 options:
1. An external file with the enum information. Both classes would import
it and could use the same enum. But he cannot change the API, so this is
no real option.
2. Change test1 into this:
On 2013-07-12, 22:38, ixid wrote:
On Friday, 12 July 2013 at 20:30:59 UTC, bearophile wrote:
ixid:
Similarly what are D user's potential issues with Go-like semi-colon
rules? And would this be possible as a subset of current D code?
Such changes will not happen even in D4. Walter is
On 2013-07-11, 20:22, Namespace wrote:
What should he do?
As far as I can see he has 3 options:
1. An external file with the enum information. Both classes would import
it and could use the same enum. But he cannot change the API, so this is
no real option.
2. Change test1 into this:
On 2013-07-08, 11:03, bearophile wrote:
Simen Kjaeraas:
However, you can amend std.traits.EnumMembers to work
with larger enums by using this version:
Worth putting in Phobos?
Filed:
http://d.puremagic.com/issues/show_bug.cgi?id=10569
And created a pull request:
https://github.com/D
On 2013-07-07, 21:55, QAston wrote:
I have a large enum in my code (opcodes for a protocol) - using
std.traits.EnumMembers gives me a recursive template error.
How can i increase max number recursive template expansions?
You can't. However, you can amend std.traits.EnumMembers to work
with
On 2013-07-03, 02:22, Brad Anderson wrote:
C++11's std::tuple includes a function std::tie that takes references to
the arguments and returns a tuple that maintains the references to the
arguments.
Along with the usual cases where you'd want reference semantics it also
enables this
On Sun, 30 Jun 2013 20:24:17 +0200, shuji cravs...@hotmail.com wrote:
int setHWND(HWND extHwnd){
hwnd = extHwnd;
return 0;
}
And:
extern (C++) {
int setHWND(HWND hwnd);
}
See how these are different? One of them is an extern (C++) function, the
other is a D
On Fri, 28 Jun 2013 20:07:23 +0200, MattCoder mattco...@hotmail.com
wrote:
Hi,
I would like to know if it's possible to pass the return of a function
as argument to another function as below:
import std.stdio;
auto foo(int x, int y){
writeln(x, y);
return 3, 4;
}
void
On Wed, 26 Jun 2013 00:07:38 +0200, Namespace rswhi...@googlemail.com
wrote:
I want to ask if this code should compile or if it's a bug, because I
circumvent the const system:
import std.stdio;
struct Point {
int x, y;
}
Point*[] points;
struct TplPoint(T) {
public:
On 2013-06-24, 22:30, Temtaime wrote:
Hello, guys !
http://dpaste.1azy.net/8917c253
I'm not sure I've seen this bug before, but yes, it is one.
The cause is that the grammar for the new alias syntax is apparently not
complete.
Please file: http://d.puremagic.com/issues/enter_bug.cgi
--
On Sat, 22 Jun 2013 18:58:22 +0200, deed n...@none.none wrote:
class A { ... }
class NonContainer : A { ... }
class Container : A { A[] container; }
class NC1 : NonContainer {}
...
class C1 : Container {}
...
A getO(string info)
{
switch (info)
{
On 2013-06-18, 05:00, bearophile wrote:
With your code I have found a dmd compiler bug, are you able and willing
to further reduce this?
Tried this with 2.063.2, and there are three errors in the code -
deserializeInto
should return its buffer, the switch on line 19 needs a default: case,
On Thu, 13 Jun 2013 14:17:22 +0200, Stephan Schiffels
stephan_schiff...@mac.com wrote:
For example, is there a way of instantiating an object normally (i.e.
mutable), and then later freeze it to immutable via a simple cast or
so?
In std.exception there is assumeUnique. It's basically
On Wed, 12 Jun 2013 10:01:59 +0200, Zhenya zh...@list.ru wrote:
Hi!
I was just surprised when realized, that this code compiles and runs:
import std.typetuple;
import std.stdio;
void main()
{
auto foo = TypeTuple!(foo,bar);
writeln(typeid(typeof(foo)));
writeln(foo);
}
If I were
On Wed, 12 Jun 2013 11:44:19 +0200, Zhenya zh...@list.ru wrote:
OK,you say that TypeTuple!(foo,bar) is a cool value of type
TypeTuple!(string,string),right?
Well, yes and no, not really. It's a bit magical. In your case,
it's assigned to an auto variable, and that variable gets that type.
On Tue, 11 Jun 2013 12:12:25 +0200, Temtaime temta...@gmail.com wrote:
ubyte k = 10;
ubyte c = k + 1;
This code fails to compile because of: Error: cannot implicitly convert
expression (cast(int)k + 1) of type int to ubyte
Why? It's pain in the ass, i think. My code contains only casts
On Tue, 11 Jun 2013 12:39:47 +0200, Temtaime temta...@gmail.com wrote:
There is overflow and it can be with int too.
It's standard behavior.
Indeed. And a class is a void* is an int is a char is a double? That's
perfectly possible - it's all just memory anyway. D has chosen to do
it like this
On Tue, 11 Jun 2013 13:15:11 +0200, Simen Kjaeraas
simen.kja...@gmail.com wrote:
On Tue, 11 Jun 2013 12:39:47 +0200, Temtaime temta...@gmail.com wrote:
There is overflow and it can be with int too.
It's standard behavior.
Indeed. And a class is a void* is an int is a char is a double
On Tue, 11 Jun 2013 13:46:11 +0200, Temtaime temta...@gmail.com wrote:
No. I means, that
uint a = uint.max;
uint b = a + 1;
writeln(b);
Works OK.
Why? Compiler doesn't know if a + b fits in uint, right?
Then why overflow with ints are accepted?
Because there's a limit to how far this goes
On 2013-05-31, 14:12, Namespace wrote:
I thougth that in dmd 2.063 alias this : foo; would be allowed.
That was what the preview of dmd 2.063 said:
http://dlang.org/changelog.html#new2_062
Why wasn't it implemented?
Probably not enough time. I've not read anything about it no
longer being
On 2013-05-31, 18:31, Carl Sturtivant wrote:
The D Programming Language (TDPL) p.178 asserts the following.
The objects themselves stay put, that is their locations in memory
never change after creation.
I take this to mean that the D garbage collector doesn't move live
objects and
On 2013-05-30, 13:56, Shriramana Sharma wrote:
Hello. I have always loved the readability of C++'s and/or/not/xor
word-like logical operators but It doesn't seem to be available in D.
Isn't this possible in D? I tried doing:
alias and ;
import std.stdio ;
void main () {
writeln ( true
On Mon, 27 May 2013 14:08:12 +0200, Joseph Rushton Wakeling
joseph.wakel...@webdrake.net wrote:
On 05/26/2013 05:59 PM, Ali Çehreli wrote:
On 05/26/2013 05:38 AM, Simen Kjaeraas wrote:
Tuple!(size_t, size_t)[][] data = createData();
immutable dataImm = assumeUnique(data
On Sun, 26 May 2013 14:06:39 +0200, Joseph Rushton Wakeling
joseph.wakel...@webdrake.net wrote:
On 05/24/2013 04:39 PM, Simen Kjaeraas wrote:
First, *is* it read-only? If so, store it as immutable and enjoy free
sharing. If not, how and why not?
I can confess that it's as simple as feeling
On Sun, 26 May 2013 14:06:39 +0200, Joseph Rushton Wakeling
joseph.wakel...@webdrake.net wrote:
On 05/24/2013 04:39 PM, Simen Kjaeraas wrote:
First, *is* it read-only? If so, store it as immutable and enjoy free
sharing. If not, how and why not?
I can confess that it's as simple as feeling
On Sun, 26 May 2013 17:59:32 +0200, Ali Çehreli acehr...@yahoo.com wrote:
On 05/26/2013 05:38 AM, Simen Kjaeraas wrote:
Tuple!(size_t, size_t)[][] data = createData();
immutable dataImm = assumeUnique(data);
data = null; // Simply to ensure no mutable references exist
On 2013-05-24, 15:26, Joseph Rushton Wakeling wrote:
Hello all,
Are there any recommended strategies for passing large or complex data
structures (particularly reference types) to threads?
For the purpose of this discussion we can assume that it's read-only
data, so if
we're talking about
On 2013-05-24, 16:49, ref2401 wrote:
Version D 2.062
Please explain what is causing the error
class Base
{ }
class Class(T) : Base
if (is(T == int))
{ }
Error: unrecognized declaration
Error: members expected
Error: Declaration expected, not 'if'
Error: { } expected following aggregate
On Thu, 23 May 2013 13:29:49 +0200, Namespace rswhi...@googlemail.com
wrote:
That was what I also expected. But opAssign is not called.
Because you have a postblit. It's called instead of opAssign.
--
Simen
On 2013-05-22, 21:30, D-sturbed wrote:
Hello, is there a way to wrap a WindowProc (so LRESULT WindowProc(HWND
hWnd, UINT message, WPARAM wParam, LPARAM lParam) nothrow) in a class
and to link it to a WindowClass without puting it as static ?
Because defacto every datum used in the
On Sat, 18 May 2013 02:12:00 +0200, Timothee Cour
thelastmamm...@gmail.com wrote:
so in what you suggest, the exact same problem remains with 'get' being
exposed instead of 'x', so the situation didn't improve...
looks like it's impossible to achieve this?
Well, there is also opDot:
On Sat, 18 May 2013 01:13:00 +0200, Timothee Cour
thelastmamm...@gmail.com wrote:
How to have alias this with an unaccessible member (x below).
Making the member private won't work as it'll disable all operations on
said member.
struct A(T){
T x;
//private T x would prevent alias
On Thu, 16 May 2013 17:01:54 +0200, Sebastian Graf
sebastiang...@t-online.de wrote:
I aim to use a simplistic, rough edged property generator, but
I'm having issues.
See http://dpaste.dzfl.pl/72837a7a.
My code and mixin logic seems to work basically, but it gets
hairy when using mixinMap to
On Wed, 15 May 2013 03:31:40 +0200, Diggory digg...@googlemail.com wrote:
I have a vector struct, Vector(T, uint N) templated on the type T and
number of components, N. I'm trying to write a function cross which
will calculate the cross product of a number of vectors.
For a given number of
On 2013-05-12, 14:00, evilrat wrote:
On Sunday, 12 May 2013 at 11:56:53 UTC, Maxim Fomin wrote:
You can place base struct instance inside nested and use alias
this. Note that currently multiple alias this are not supported.
Also note that you cannot override functions because there are no
On 2013-05-05, 01:42, Diggory wrote:
I'm trying to test using a static if statement if a tuple of strings
contains a particular string. What's the easiest/best way to do this?
http://dlang.org/phobos/std_typetuple#.staticIndexOf
--
Simen
On 2013-05-02, 20:14, Carlos wrote:
I have this code :
import std.stdio;
import std.c.stdlib;
void main()
{
int fahr;
write(F\tC\n);
for (fahr = 0; fahr = 300; fahr = fahr + 20)
write(fahr, \t, (5.0/9.0)*(fahr-32), \n);
write(Done!\n);
exit (0);
}
Which works. but if I change the 5.0 for 5 I
On Sat, 13 Apr 2013 18:36:21 +0200, Jeremy DeHaan
dehaan.jerem...@gmail.com wrote:
I'm on Windows, and I my compilation was nothing more than dmd -O
-release main.d to get the issue I described.
Turns out, the problem starts here:
static const(float) pi = 3.141592654f;
If we compare
On 2013-04-18, 16:20, ixid wrote:
An array is represent using a struct with a pointer to the array data
and the length, like this:
struct Array
{
void* ptr;
size_t length;
}
The struct is passed by value, but since it contains a pointer to the
data it will be passed by reference.
On 2013-04-17, 19:15, Janissary wrote:
Is it possible to evaluate an enum's base type? Ideally something like:
enum somestrs : string { ... }
enum d = 0.0;
template EnumBaseType(E) if (is(E==enum)) { ... }
unittest {
static assert( is(EnumBaseType!somestrs == string) );
static assert(
On Sat, 13 Apr 2013 08:07:39 +0200, Jeremy DeHaan
dehaan.jerem...@gmail.com wrote:
In debug mode this works as expected. Let's say the radius is 50.
getPoint(0) returns a vector that prints X: 50 Y: 0. For some reason,
the same function will return a vector that prints X: 50 Y:
On 2013-04-08, 14:23, Minas Mina wrote:
How can I define operator += for a struct?
http://dlang.org/operatoroverloading.html
In short:
struct S {
auto opOpAssign( string op : + )( S other ) {
// Do stuff here.
}
}
--
Simen
On 2013-01-30, 17:08, andrea9940 wrote:
This code compiles fine:
struct Vector(T, uint SIZE)
{
T[SIZE] vector;
this(T value) {
foreach (ref v; vector) v = value;
}
}
alias Vector!(int, 3) Vec3i;
but if I add a variadic
On 2013-01-16, 22:02, Nick Sabalausky wrote:
Unfortunately, opDispatch [silently] takes precedence over
UFCS. I don't suppose there's any way to make a UFCS function call
override opDispatch without either ditching UFCS or altering/removing
the opDispatch itself?
Only solution I know of is to
On 2013-04-15 13:01, Mike Parker aldac...@gmail.com wrote:
On Monday, 14 January 2013 at 21:00:12 UTC, Simen Kjaeraas wrote:
alias foo = extern(System) void function();
Gives me an error about expecting basic type, not extern.
extern(System) alias void function() foo;
But that's the old
On 2013-55-08 09:01, monarch_dodra monarchdo...@gmail.com wrote:
Sometimes (especially in phobos), one defines a parametrized template,
that resolves to a templated function.
This is a nifty trick, because it allows specifying a vararg before the
current type parameter, eg:
//
auto r
On 2013-16-08 11:01, monarch_dodra monarchdo...@gmail.com wrote:
On Tuesday, 8 January 2013 at 09:59:26 UTC, Simen Kjaeraas wrote:
alias fun2 = fun!(++a, --a);
auto m = fun2!(ubyte)(1);
Nice!
And now, for the 1M$ question: Can I rely on this behavior, or is this
an accepts invalid
On 2013-52-05 20:01, Michael Engelhardt m...@mindcrime-ilab.de wrote:
Hi,
just playing around with the functional capabilities of D. One concept
of the pure functional programming is that variables should not be
reassigned, so the best(?) way to assure this is using immutable:
On 2012-48-29 14:12, mist n...@none.none wrote:
I basically want to be able to do stuff like this:
auto result = map!( (a, b) = a+b )( lockstep(range1, range2) );
Are there any standard short ways to wrap an input range around struct
with opApply (which Lockstep is)?
Also what about
On 2012-52-29 20:12, mist n...@none.none wrote:
Not clever enough to expand like this though:
map!( (a, b) = a+b )( zip(Range1, Range2) );
Using a = a[0]+a[1] is not that big deal though.
That oughta be doable. However, seeing as std.functional only contains
unaryFun and binaryFun (dranges
On 2012-42-28 16:12, Zhenya zh...@list.ru wrote:
Hi!
Tell me please,are there any way to check whether number is NaN?
us std.math.isNaN. But if you really don't want to:
float x = ...;
if (x != x) {
writeln( x is NaN );
}
I'm unsure how aggressive the optimizer is allowed to be in
On 2012-09-16 17:12, bioinfornatics bioinfornat...@fedoraproject.org
wrote:
Dear,
I wrote a fasta format parser and fastq format parser. These parser used
MmFile and do not load all file these will save memory.
Fastq http://dpaste.dzfl.pl/9b23574d
Fasta http://dpaste.dzfl.pl/228dba11
The
On 2012-12-14, 00:19, H. S. Teoh wrote:
I'd like to overload the '*' operator to work with string arguments. Is
it possible? I tried the following, but apparently operator overloading
doesn't work at the package level?
string opBinary(string op)(string repeatMe, int thisManyTimes)
On 2012-12-06, 20:17, Suliman wrote:
I am learning D classes and I am getting error when I am try to make
instance of class. erorr:
C:\code\main.d(9): Error: constructor GetFileName.GetFileName.this
(string name) is not callable using argument types ()
On 2012-12-06, 20:48, Suliman wrote:
When I should use keyword this?
I dropped it from my class and now I can make instance of class without
in sych way:
auto file = new GetFileName();
file.name = test;
Indeed. If you have not defined a constructor, the language defines one
for you, which
On 2012-12-05, 20:03, js.mdnq wrote:
sizeof always returns 4 or 8 regardless of size of class:
class myclass(T)
{
public:
T v1;
T v2;
T v3;
T v4;
T v5;
T v6;
}
writeln((myclass!byte).sizeof, (myclass!double).sizeof);
or even
On 2012-11-29, 17:33, Zhenya wrote:
Hi!
It would useful for some my project,if operators could be a
template,that return
type.Something like
alias TypeTuple!(int,char) types;
static assert(types[1] == char) //opIndex
So can I define something like that?
This works out of the box. If you
On 2012-11-16, 16:49, bioinfornatics wrote:
hi,
I would like to count number of one ore more letter into a string or
list of string (string[]) without use a for loop but instead using
std.algorithm to compute efficiently.
if you have:
string seq1 = ACGATCGATCGATCGCGCTAGCTAGCTAG;
On 2012-11-16, 17:37, bearophile wrote:
Simen Kjaeraas:
There. Now it works, and returns a Tuple!(ulong,ulong)(8, 8).
One thing I think is ugly in my implementation is acc + (seq == 'G').
This
adds a bool and a ulong together. For more points, replace that with
acc + (seq == 'G' ? 1 : 0
On 2012-23-15 15:11, Dan dbdavid...@yahoo.com wrote:
There are times when casting away const is needed. Structs that
define opCast can get in the way of this. For instance, the cast
below fails, but I think it should always be allowed. So, if the
source type and cast type are the same except
On 2012-34-11 18:11, bioinfornatics bioinfornat...@fedoraproject.org
wrote:
Hi,
I wrote a fasta parser for biology computing
http://pastebin.geany.org/yheQN/
I would like to get your experience to know if the writer could be
better. The given parser use MmFile and Phobos range.
fasta
On 2012-11-06, 16:20, Joseph Rushton Wakeling wrote:
Suppose that I have two struct templates which take identical parameter
lists:
struct Foo(T1, T2, T3)
{
...
}
struct Bar(T1, T2, T3)
{
...
}
Now suppose that I have a Foo which has been
On 2012-11-05, 15:53, Joseph Rushton Wakeling wrote:
Hello all,
Suppose I want to define a tuple type which may have a variable length,
e.g.:
template Tup(ID, Properties...)
{
static if(Properties.length == 0)
alias Tuple!(ID, id)
On 2012-18-01 23:11, They call me Mr. D khea...@eapl.org wrote:
auto i = SList!int(1, 2, 3, 4, 5, 6, 7);
auto f = SList!float(1.1, 2.234, 3.21, 4.3, 5.001, 6.2, 7.0);
auto s = SList!string([I, Hello, World]);
auto c = SList!char('a', 'b' ,'c'); // doesn't compile, get the
following
On 2012-11-01, 19:52, Justin Whear wrote:
On Thu, 01 Nov 2012 19:42:07 +0100, denizzzka wrote:
For example, adding 3 strings to type tuple t:
foreach( i; 0..2 )
alias TypeTuple!( t, string ) t; // this is wrong code
and result should be:
TypeTuple!( string, string, string );
Use a
On 2012-08-28 22:10, Tyro[17] nos...@home.com wrote:
On 10/28/12 4:44 PM, Dmitry Olshansky wrote:
On 29-Oct-12 00:36, Tyro[17] wrote:
The following fails because the compiler assumes I am trying to
dereference non-pointer variables. Can this be done?
void main()
{
int i;
int* pi;
On 2012-41-24 01:10, Adam D. Ruppe destructiona...@gmail.com wrote:
On Tuesday, 23 October 2012 at 23:07:28 UTC, Jonathan M Davis wrote:
I think that Andrei was arguing for changing how the compiler itself
handles arrays of char and wchar so that they wouldn't
As I said last time this came
On 2012-10-23, 19:21, mist wrote:
Hm, and all phobos functions should operate on narrow strings as if they
where not random-acessible? I am thinking about something like
commonPrefix from std.algorithm, which operates on code points for
strings.
Preferably, yes. If there are performance
On 2012-36-22 01:10, bearophile bearophileh...@lycos.com wrote:
This benchmark shows that if you allocate the class instances on the
heap one at a time the total amount of memory used is the same for the
various Bar (maybe because of the GC), so that optimization is useful
for emplace()
On 2012-10-18, 17:45, Oleg wrote:
Sorry. My problem more complex and my simplification is not correct.
I want use mixin for math operations.
mixin template vectOp( string DataName, int DataLen, T, vecType )
{
mixin( alias ~ DataName ~ this; );
auto opBinary(string op,E)(
On 2012-10-17, 21:17, m0rph wrote:
I tryed to learn how arrays works and found another strange thing:
import std.stdio;
int[] create()
{
int[5] a1 = [ 10, 20, 30, 40, 50 ];
int[] b1 = a1;
writeln(b1: , b1);
return b1;
}
void main()
{
int[] a2 =
On 2012-05-15 16:10, Namespace rswhi...@googlemail.com wrote:
How can I do this?
I have this code: http://dpaste.dzfl.pl/d9165502
And as you can see, the templated function 'receive2' take automatically
dynamic arrays. But how can I tell the compiler, that this function
takes (preferably)
On 2012-23-15 16:10, Simen Kjaeraas simen.kja...@gmail.com wrote:
On 2012-05-15 16:10, Namespace rswhi...@googlemail.com wrote:
How can I do this?
I have this code: http://dpaste.dzfl.pl/d9165502
And as you can see, the templated function 'receive2' take
automatically dynamic arrays
On 2012-35-15 17:10, Namespace rswhi...@googlemail.com wrote:
But bar([1, 2, 3]); not. The compiler does not realize that [1, 2, 3]
means a static array in this context.
You have to write bar(cast(int[3]) [1, 2, 3]); but I think the compiler
have to recognize this on it's own.
This is
On 2012-10-14, 14:28, Martin wrote:
Hey everyone, I'm new to D so bare with me please. I've been trying to
figure out what's up with the strange forward refernce errors the
compiler (DMD 2.060) is giving me. Here's a code snippet that's
generating a forward reference error:
public class
On 2012-01-10 02:10, Josh moonbur...@gmail.com wrote:
Is there a way to do that? I've tried getenv(PROCESSOR_ARCHITECTURE)
and shell(echo %PROCESSOR_ARCHITECTURE%), and both of them return
x86 instead of AMD64 like cmd. I want to use this to run a 64 bit
version of an external program if
On 2012-09-27, 00:02, Jonathan M Davis wrote:
Classes will not work for the same reason that you can never use a class
object as an enum with manifest constants.
Has a decision been made as to whether or not this will be possible in the
future?
--
Simen
On Wed, 19 Sep 2012 15:45:21 +0200, Namespace rswhi...@googlemail.com
wrote:
On Wednesday, 19 September 2012 at 13:32:42 UTC, Namespace wrote:
Is that possible?
I can initialize an object with scope or, in feature, with scoped,
directly on the stack but is it also possible to move an
On Wed, 19 Sep 2012 22:25:46 +0200, Øivind oivind@gmail.com wrote:
I am struggeling to get around the cycle detection kicking in when I
have static init in modules that depend on eachother.
I have seen some threads on 'fixes' for this, e.g. adding a @standalone
property to the module
On Fri, 14 Sep 2012 16:27:55 +0200, monarch_dodra monarchdo...@gmail.com
wrote:
On Friday, 14 September 2012 at 11:17:55 UTC, Jacob Carlborg wrote:
On 2012-09-14 12:52, monarch_dodra wrote:
int x = void;
http://dpaste.dzfl.pl/24c1baa9
Hum, but that is a stack allocated variable.
On Tue, 11 Sep 2012 20:48:25 +0200, Ali Çehreli acehr...@yahoo.com wrote:
Or you can write or find a template that produces the largest type among
the members of a union.
std.traits.CommonType.
--
Simen
On Wed, 05 Sep 2012 02:55:45 +0200, Nicholas Londey lon...@gmail.com
wrote:
Hello.
I am trying to work out if there is existing support for strongly typed
numerical values for example degrees west and kilograms such that they
cannot be accidentally mixed in an expression. I have vague
On Fri, 31 Aug 2012 16:56:32 +0200, Joseph Rushton Wakeling
joseph.wakel...@webdrake.net wrote:
Hello all,
Is it considered legit in any circumstances for popFront to take an
input variable (e.g. a random number generator)? Or is it required
always to have no input variables?
No
On Tue, 28 Aug 2012 12:10:47 +0200, monarch_dodra monarchdo...@gmail.com
wrote:
From TDPL: 7.18:
Unlike classes nested within classes, nested structs and nested classes
within
structs don’t contain any hidden member outer—there is no special code
generated.
The main design goal of
On Wed, 22 Aug 2012 13:09:49 +0200, bearophile bearophileh...@lycos.com
wrote:
Minas Mina:
I think it's a bug, what do you think?
Search for it in Bugzilla. Maybe it's there already.
Bye,
bearophile
It is. #7021/#8457
--
Simen
1 - 100 of 453 matches
Mail list logo