On Monday, 19 January 2015 at 02:10:41 UTC, Rikki Cattermole
wrote:
"subConfigurations": {
"somepackage": "glut-app"
}
}
Ahh I guess this is it, thanks for that!
On Monday, 19 January 2015 at 02:10:41 UTC, Rikki Cattermole
wrote:
I just want to verify, you are using configurations only to
determine if its being built a certain way?
And not lets say as a subpackage?
Some dependency (that I don't control) might define for example
two configurations, a s
Given myapp and a dependency, specified by dub.json's:
myapp: dub.json
{
...
"dependencies": {
"dependency_a": ">=0.6.0"
}
...
}
dependency_a: dub.json
{
...
"configurations": [
{
"name": "config_a",
"targetType": "library",
...
},
{
"name": "con
ompiled it in a
while). Might it be worth stitching things together into a proper
image processing package?
Cheers,
cal
I have the following code (on dpaste,
http://dpaste.dzfl.pl/636c04430a33):
enum : uint { a, b, c }
enum list = [a, b];
void foo(T...)()
{
pragma(msg, T[0].length); // fine
pragma(msg, T[0][0]); // fine
pragma(msg, T[0][1]); // fine
foreach(i; Iota!(0,T[0].length)) // fi
On Tuesday, 25 February 2014 at 23:09:43 UTC, Jonathan M Davis
wrote:
On Tuesday, February 25, 2014 22:32:44 cal wrote:
Grammar spec (http://dlang.org/grammar.html#AliasDeclaration)
allows:
AliasDeclaration:
alias BasicType Declarator
DMD allows:
alias ref int MyRefInt;
Is the ref
Grammar spec (http://dlang.org/grammar.html#AliasDeclaration)
allows:
AliasDeclaration:
alias BasicType Declarator
DMD allows:
alias ref int MyRefInt;
Is the ref storage class allowed by the current grammar spec?
On Wednesday, 19 February 2014 at 09:45:41 UTC, Tolga Cakiroglu
wrote:
I have written a programme and a library under Linux. When
programme is run, it tries to load the library. Both the
programme code and the library imports a module as
"apps.common.lib.config". Now, when I run the programme,
On Monday, 27 January 2014 at 06:51:57 UTC, dennis wrote:
I am having trouble understanding how to navigate the tree
returned by std.json. I am new to D programming, I have tried
reading the std.json source code but I am still stumped.
I usually end up doing something like this when dealing w
On Friday, 3 January 2014 at 19:37:04 UTC, Colden Cullen wrote:
I'm using 2.064.2, and I'm having a very similar issue. For me,
the program doesn't crash until after my main has finished
executing. Does anyone have any idea what might be going on?
For me the problem was related to this:
https:
On Friday, 5 July 2013 at 03:12:44 UTC, Meta wrote:
I wasn't 100% sure the following is a bug, so I figured I'd ask.
struct Fail
{
void opDispatch(string s)()
{
static assert(false, "Tried to call a method on Fail");
}
}
void main()
{
auto fail =
On Wednesday, 3 July 2013 at 05:10:03 UTC, Jonathan M Davis wrote:
On Wednesday, July 03, 2013 07:04:47 cal wrote:
On Wednesday, 3 July 2013 at 04:32:15 UTC, Jonathan M Davis
wrote:
> On Wednesday, July 03, 2013 06:23:12 Josh wrote:
>> writeln(to!double("151.42499"));
On Wednesday, 3 July 2013 at 04:32:15 UTC, Jonathan M Davis wrote:
On Wednesday, July 03, 2013 06:23:12 Josh wrote:
writeln(to!double("151.42499"));//prints 151.425
Is there any way to stop this rounding?
No. double can't hold the value 151.42499. There are _tons_ of
values that it
can't
On Wednesday, 3 July 2013 at 04:23:17 UTC, Josh wrote:
writeln(to!double("151.42499"));//prints 151.425
Is there any way to stop this rounding?
Thanks,
Josh
The rounding is probably just a stdio default floating point
format, ie:
writefln("%.10f", to!double("151.42499")); // 151.42499
On Tuesday, 2 July 2013 at 11:04:20 UTC, Artur Skawina wrote:
To avoid this kind of issues:
struct S {
template opDispatch(string s) if (s.startsWith("foo")) {
void opDispatch(T...)(T t) {
writeln(s);
}
}
}
That's a handy workaround, tha
import std.conv, std.stdio, std.algorithm;
struct S {
void opDispatch(string s, T...)(T t) if (s.startsWith("foo"))
{
writeln(s);
}
}
void main() {
S s;
s.foo();
auto p = s.to!string(); // Error: s.opDispatch!("to") isn't a
template
}
Should the constraint on opD
On Wednesday, 26 June 2013 at 05:08:07 UTC, Jonathan M Davis
wrote:
On Wednesday, June 26, 2013 06:59:14 cal wrote:
On Wednesday, 26 June 2013 at 04:06:05 UTC, Jonathan M Davis
wrote:
> Yeah, that should work for the conditions in if, while, and
> for
> loops but
> won't
On Wednesday, 26 June 2013 at 04:06:05 UTC, Jonathan M Davis
wrote:
Yeah, that should work for the conditions in if, while, and for
loops but
won't work for anything else (_maybe_ ternary operators, but
I'm not sure).
So, if you need to be able to do !obj in the general case,
that's not going t
On Wednesday, 26 June 2013 at 02:50:51 UTC, Eric wrote:
Is there a way to overload the ! operator? I can't seem to get
it to work with the standard unaryOp method. I need this
because
I am making a wrapper for a C++ API that has ! overloaded.
-Eric
According to http://dlang.org/operatorov
On Tuesday, 25 June 2013 at 06:58:33 UTC, monarch_dodra wrote:
On Tuesday, 25 June 2013 at 04:26:00 UTC, Timothee Cour wrote:
I think it's because each lambda litteral is treated unique.
can dmd be changed to recognize identical lambda litterals as
identical? Is
there any particular issue maki
Is it by design that the code below does not compile?
import std.algorithm, std.range;
void main() {
typeof(iota(10).map!(a=>a)) x = iota(10).map!(a=>a);
}
Error message (DMD git-latest on DPaste):
Error: constructor f755.main.MapResult!(__lambda2,
Result).MapResult.this (Result input) i
On Monday, 24 June 2013 at 05:31:29 UTC, Ali Çehreli wrote:
On 06/23/2013 10:07 PM, Ali Çehreli wrote:
> I think it is a compiler bug.
Make that a Phobos bug. :)
The following is a reduced program that exhibits the problem.
The presence or absence of the unused member function makes a
differ
What is going on here?
import std.stdio, std.typecons;
struct S
{
int x;
Tuple!(S) foo() { return tuple(this); }
}
void main()
{
S s;
s.x = 8;
writeln((s.foo())); //output: Tuple!(S)(S(8))
writeln((s.foo())[0]); //output: S(0)
}
On Wednesday, 10 April 2013 at 18:24:58 UTC, Jesse Phillips wrote:
On Monday, 8 April 2013 at 05:12:24 UTC, cal wrote:
class C(T){}
class CC(T){}
struct S(T){}
struct SS(T){}
void main()
{
import std.stdio;
writeln(typeid(S!(SS!int)).name); // S!(SS!(int)).S
writeln(typeid(C!(CC!int
class C(T){}
class CC(T){}
struct S(T){}
struct SS(T){}
void main()
{
import std.stdio;
writeln(typeid(S!(SS!int)).name); // S!(SS!(int)).S
writeln(typeid(C!(CC!int)).name); // C!(CC).C
}
Is there a way to get the full type info in the name for a
templated class (i.e. like the struct
On Saturday, 6 April 2013 at 21:40:37 UTC, bearophile wrote:
First, to see the side effects you have also to call front:
Ah thank you, I did not realize a call to front was required.
But this is wrong still. map() is a higher order function, it's
meant to take a function and an iterable and p
Should the code below print anything (it currently doesn't)? I'm
not sure I understand map:
import std.stdio, std.algorithm;
void main() {
int[] a = [1,2,3,4,5];
auto r = a.map!( i => writeln(i) );
while(!r.empty) r.popFront();
}
On Thursday, 28 March 2013 at 23:02:31 UTC, Timothee Cour wrote:
In code below, does transTable have a well defined type?
it seems to change from line 9 (string[char])
to line 10 (string[dchar])...
My guess:
The enum version is like saying this:
auto s = translate("[", ['[' : `\[`]);
here the
On Thursday, 28 March 2013 at 20:18:45 UTC, Andrej Mitrovic wrote:
On Thursday, 28 March 2013 at 20:02:18 UTC, cal wrote:
.offsetof will also require access rights to the fields.
Just realized that format.d is able to figure it out, since it
prints #{overlap...} for unions. I can use that
On Thursday, 28 March 2013 at 20:18:45 UTC, Andrej Mitrovic wrote:
.offsetof will also require access rights to the fields.
Yeh this is the problem. I can map data layout of complex
aggregates, even if the members are private, but unions mess that
up. Restricting to public fields is an option
Given:
struct S {
union {
int i;
float f;
}
}
is there any way to detect the fact that fields i and f will have
the same offset from S? (Creating an instance of S and getting
the relative addresses only works if the union is public).
On Tuesday, 26 March 2013 at 16:31:51 UTC, Jonathan Crapuchettes
wrote:
but I wish there was a cleaner way to do it. If the FieldSpec
template
was moved into the public section, it would allow for the name
member to
be accessed.
Not sure this qualifies as clean, but it's an option:
import s
On Tuesday, 26 March 2013 at 13:45:52 UTC, Ali Çehreli wrote:
There are three kinds of template parameters: type, value, and
alias.
That syntax does not work because you are trying to match 5 to
V, where 5 is a value and V is a type.
Ali
Thanks Ali,
I guess the tuple version is fine, it i
On Tuesday, 26 March 2013 at 06:15:54 UTC, cal wrote:
static if (is(S!(int, 5) _ : S!(U), U...)) // line B, fail
pragma(msg, U.stringof); // tuple(int, 5);
oops the '// line B, fail' should not be there
On Tuesday, 26 March 2013 at 06:03:55 UTC, cal wrote:
I.e., why I can't match on some generic second parameter - what
if the second parameter was an int:
struct S(A, int B) {}
static assert(is(S!(int, 5627) _ == S!(U, ??), U, ??));
how to match that in the isExpression?
cheers,
cal
Ho
ch on some generic second parameter - what
if the second parameter was an int:
struct S(A, int B) {}
static assert(is(S!(int, 5627) _ == S!(U, ??), U, ??));
how to match that in the isExpression?
cheers,
cal
On Friday, 22 March 2013 at 11:23:30 UTC, timotheecour wrote:
void main(){
import std.demangle;
import std.stdio;
writeln(demangle("_D5tango4text7convert6Format12__ModuleInfoZ"));
//_D5tango4text7convert6Format12__ModuleInfoZ
writeln(demangle("_D5tango4text7Unicode
On Wednesday, 20 March 2013 at 20:11:47 UTC, Peter Sommerfeld
wrote:
In std.json is a function getchar() with this signature:
dchar getChar(bool SkipWhitespace = false);
It looks like the signature (line 115) is:
dchar getChar(bool SkipWhitespace = false)()
Note the extra set of parens at the
On Tuesday, 19 March 2013 at 17:04:01 UTC, cal wrote:
On Tuesday, 19 March 2013 at 16:35:22 UTC, Dan wrote:
This used to work but now in 2.062 it causes ctfe error.
Any suggested workaround?
This seems to work:
Or:
const(Date) DefaultDate = { return Date(1929,10,10); }();
although this is
On Tuesday, 19 March 2013 at 16:35:22 UTC, Dan wrote:
This used to work but now in 2.062 it causes ctfe error.
Any suggested workaround?
This seems to work:
Date defDate() pure { return Date(1929, 10, 29); }
const(Date) DefaultDate = defDate();
Assuming you wanted to avoid a initializing insi
On Monday, 11 March 2013 at 23:38:20 UTC, Andrej Mitrovic wrote:
On 3/12/13, cal wrote:
if i remove the parenthesis around 'other'.
Ah yes, I can recreate it now. Can you file this as a bug?
Sure thanks for checking it
On Monday, 11 March 2013 at 23:22:42 UTC, cal wrote:
On Monday, 11 March 2013 at 23:19:18 UTC, cal wrote:
On Monday, 11 March 2013 at 23:10:58 UTC, Andrej Mitrovic
I can't reproduce this. How are you compiling the modules?
Specifically:
dmd main.d other.d dir/other.d
produces:
On Monday, 11 March 2013 at 23:19:18 UTC, cal wrote:
On Monday, 11 March 2013 at 23:10:58 UTC, Andrej Mitrovic wrote:
On 3/11/13, cal wrote:
When the module name I use inside __traits is in the same dir
as
the main module, I need the extra parenthesis to satisfy the
compiler. Is this a bug
On Monday, 11 March 2013 at 23:10:58 UTC, Andrej Mitrovic wrote:
On 3/11/13, cal wrote:
When the module name I use inside __traits is in the same dir
as
the main module, I need the extra parenthesis to satisfy the
compiler. Is this a bug, or unavoidable?
I can't reproduce this. How ar
DMD 2.062:
//-- module other.d, same dir as main --
module other;
int j;
//--
//-- module dir/other.d, subdir of main --
module dir.other;
int j;
//--
//-- module main.d --
module main;
import other;
pragma(msg, [__traits(allMembers, (other))]);
import dir.other;
pragma(msg, [__traits(allMe
On Monday, 11 March 2013 at 15:25:55 UTC, Peter Sommerfeld wrote:
Seems I have to dig into the implementation for a workaround
or use
my own union to integrate the types.
Thanks, Peter
To get the held type of a Variant, use .type():
if(value.type() == typeid(Map))
writeln("value == map")
On Friday, 8 March 2013 at 23:15:30 UTC, Zhenya wrote:
Yes,it's a typo.But it seems to be ugly pass dynamically
allocated array through
a template parameter,because it's size should be compile-time
constant.
Its size is a compile-time constant because it is an array
literal. The size is known
On Friday, 8 March 2013 at 23:03:47 UTC, Zhenya wrote:
Your constraint could be:
if(is(typeof(size) _ == int[]) && size.length > 0)
Also it looks like you are passing 1 too many template args?
static if(n > 1)
NDimensionalArray!(T,n - 1,size[1..$]) m_array[size[0]];
On Tuesday, 5 March 2013 at 12:58:57 UTC, Timon Gehr wrote:
Compiles as expected with DMD 2.060. It is probably a
regression.
Ah you're right, also with 2.061. I'll file.
On Tuesday, 5 March 2013 at 08:14:58 UTC, simendsjo wrote:
Hmm.. And this also works:
enum c = __traits(compiles, mixin("{auto a = new 1;}"));
Something to do with CTFE combined with mixins?
But it gets this right, in that c is false. I had thought that by
wrapping the declaration in braces,
On Tuesday, 5 March 2013 at 08:04:12 UTC, Andrej Mitrovic wrote:
You can't test declarations inside of __traits(compiles), only
expressions. It's in the docs:
http://dlang.org/traits.html#compiles
So why does this work:
import std.conv;
void main()
{
enum s = "`1`.to!int;";
enum c =
I'm confused about this:
import std.conv;
void main()
{
enum s = "`1`.to!int;";
enum c = __traits(compiles, mixin("{auto a = new "~s~";}"));
// line 1
mixin("auto a = "~s~";");
// line 2
}
This does not compile, giving errors about instantiating
On Sunday, 24 February 2013 at 17:30:14 UTC, Damian wrote:
That solution is ok for 1 argument but for many arguments it
wont suffice.
This is issue 5028.
What is the problem with many arguments? I'm probably
misunderstanding, but e.g. this works:
struct MySignal(T...)
{
mixin Signal!T
On Saturday, 23 February 2013 at 17:01:48 UTC, Damian wrote:
Ok signals work fine, until I use them in a descendant class.
Snippet:
-
import std.signals;
class ClassA
{
public mixin Signal!(int) addNumber1;
}
class ClassB : ClassA
{
public mixin Signal!(int) add
On Wednesday, 20 February 2013 at 07:54:19 UTC, monarch_dodra
wrote:
Note that an Error is not an Exception, and an Exception is not
an Error. Both, however, are Throwable's. If you want to catch
an *anything*, then catch a Throwable.
As already mentioned though, catching an Error is not somet
On Wednesday, 20 February 2013 at 01:19:54 UTC, Ali Çehreli wrote:
The example is wrong. a[4] throws an Error (not Exception) but
collectException catches Exception by default.
Additionally, the example is doing something that is
recommended against: Catching Error or a descendent of it.
Sti
Is this example from the docs still meant to work?
int[] a = new int[3];
int b;
assert(collectException(a[4], b));
Is there a way to make this sort of thing work?
import std.algorithm;
struct S
{
int[] arr;
alias arr this;
}
void main()
{
auto s = S([1,2,3]);
sort(s); // error: template std.algorithm.sort does not
match any function
// template declaration. Candidates are...
On Thursday, 14 February 2013 at 07:40:58 UTC, Jacob Carlborg
wrote:
This is by design. Foo and A have different overload sets. Try:
alias Foo.foo foo;
http://dlang.org/template-mixin.html
Search for: "Mixin Scope" and pay attention to:
"Alias declarations can be used to overload together fun
And a related question:
class A
{
void foo(int i){}
void foo(Tuple!(int) i){}
}
class B: A
{
override void foo(int i){}
}
int main()
{
auto b = new B;
b.foo(tuple(5));
}
This fails to compile. Why can't B use A's tuple overload of
foo()? If I do this:
class B: A
{
Should the following work?
import std.traits;
mixin template Foo()
{
void foo(T)(T t) if (isSomeString!T) {}
}
class A
{
void foo()(int i){}
mixin Foo;
}
void main()
{
auto a = new A;
a.foo("hello");
}
Error: template hello.A.foo does not match any function template
decla
On Monday, 28 January 2013 at 10:44:22 UTC, qznc wrote:
On Monday, 28 January 2013 at 03:16:24 UTC, cal wrote:
Is the 'typeof((int a){return z;})' getting it wrong here?
Do you really need the type? You could just use "auto".
auto dg = (int a) {return z;};
Yeah
This fails:
void main() {
int z;
typeof((int a){return z;}) dg;
dg = (int a) {return z;};
}
Error: cannot implicitly convert expression (__lambda2) of type
int delegate(int a) nothrow @safe to int delegate(int a) pure
nothrow @safe
But I can't make the delegate pure:
dg = (int a)
On Wednesday, 23 January 2013 at 02:40:55 UTC, Andrej Mitrovic
wrote:
Try making these changes:
https://github.com/AndrejMitrovic/WindowsAPI/commit/6d8ef98508063c5a4741c72eda68aa485d3b25fa
WindowsAPI should really be moved to Github..
Thanks this fixed another error i was getting, compiler is
n the
compiler? I didn't see this error with earlier releases.
Cheers,
cal
On Tuesday, 22 January 2013 at 09:47:25 UTC, monarch_dodra wrote:
Avoids deadlock.
imagine 2 threads:
a: from 2 to 5.
b: from 5 to 2.
If both threads acquire their first lock, then you have a dead
lock, and your program is basically dead.
By always locking low first, you avoid the deadlock i
On Tuesday, 22 January 2013 at 08:12:03 UTC, qznc wrote:
On Tuesday, 22 January 2013 at 00:10:22 UTC, bearophile wrote:
I suggest to put your code on Rosettacode now, and then we'll
do the changes there... As you see in other answers, both me
and monarch_dodra have other ideas for improvements.
On Tuesday, 11 December 2012 at 15:38:38 UTC, monarch_dodra wrote:
On Tuesday, 11 December 2012 at 14:57:27 UTC, monarch_dodra
wrote:
:/
I got it to work with a cast, which removes the ambiguity:
auto p = &cast(int)s.front;
But it feels hackish. Any other way?
auto p = &(s.front());
Not s
Trying to debug a D dll, using Windgb.
The dll is built using:
dmd -c -g filename.d
dmd -g filename.obj filename.def
with a def file*. I can load the dll from a D program manually,
and call functions within it. But I now need to debug some of
those functions, by stepping into them from the mai
On Monday, 12 November 2012 at 21:08:43 UTC, simendsjo wrote:
It's not a bug.
string is an alias for immutable(char)[].
ubyte can be implicitly converted to char.
All your numbers are less than 256, so dmd is able to convert
them to char.
If you try this, it fails.
string s = [256]; // 256 is
Is the following a bug?
import std.c.string, core.memory;
void* makeNew(T)()
{
T t = T.init;
void* ptr = GC.malloc(T.sizeof);
memcpy(ptr, &t, T.sizeof);
return ptr;
}
void main()
{
alias string T;
T* iptr = cast(T*)makeNew!(T);
(*iptr) = [1,2,3]; // this is allowed
}
On Sunday, 11 November 2012 at 02:55:09 UTC, Alex Rønne Petersen
wrote:
Can you give a self-contained repro that illustrates the
problem?
Also, please use core.sys.windows.windows instead. The std.c.*
package is going to be deprecated soon-ish.
import core.sys.windows.windows;
void main()
{
On Sunday, 11 November 2012 at 02:55:09 UTC, Alex Rønne Petersen
wrote:
Can you give a self-contained repro that illustrates the
problem?
Also, please use core.sys.windows.windows instead. The std.c.*
package is going to be deprecated soon-ish.
import core.sys.windows.windows;
void main()
{
I want to call Windows api function VirtualAlloc. I include
std.c.windows.windows but get the following error from dmd 2.061
(and 2.060):
Error: no size for type nothrow extern (Windows) int()
What does this message mean? If I provide my own prototype of the
function, same error.
On Monday, 5 November 2012 at 16:41:16 UTC, Jack Applegame wrote:
How to get range for single just inserted element?
DList!int list;
...
list.insertBack(5);
auto r = ??? // get range for single last element
...
list.insertBack(something);
...
list.remove(r);
http://forum.dlang.org/thread/cfkll
Following the D win32 dll example (http://dlang.org/dll.html), I
created a d dll with a simple exported function, which i then
dynamically load and call (just like the example). This works
fine, however Runtime.unloadLibrary does not return. I do however
get the "DLL_PROCESS_DETACH" message, so
I am trying to read the text file (trace.log) created by running
the dmd profiler on some code, so that I can use demangle to make
the output a bit more readable. I can read it in as a char[], but
the whenever I try any string ops I get an exception because
there are invalid UTF-8 sequences in
On Friday, 26 October 2012 at 15:14:56 UTC, Dan wrote:
Still trying to understand this. I found that if I change the
following in Proxy it this example (r1 + r2) works fine. Plus
the unit tests that are there still work. But, honestly I don't
understand why...yet.
Thanks,
Dan
- From type
On Monday, 22 October 2012 at 04:59:41 UTC, Jonathan M Davis
wrote:
Blocks of memory are allocated and freed as a whole. When an
array is forced
to be reallocated, then a new block of memory is allocated for
it, and any
existing slices continue to refer to the original block of
memory. The
orig
Just want to make sure I understand this properly:
I have a large dynamic array (whose elements are immutable) which
only ever grows. I also have a whole lot of small slices into
this array, the slices never change, and they don't span the
entire contents of the array (they are just pieces).
On Sunday, 21 October 2012 at 20:54:15 UTC, ref2401 wrote:
On Sunday, 21 October 2012 at 20:42:08 UTC, cal wrote:
On Sunday, 21 October 2012 at 20:34:51 UTC, ref2401 wrote:
what should i do to make my binary operation commutative?
in the following case
auto v5 = v1 + v2;
there will be
On Sunday, 21 October 2012 at 20:34:51 UTC, ref2401 wrote:
what should i do to make my binary operation commutative?
You can overload opBinaryRight:
MyClass opBinaryRight(string op: "+")(MyClass rhs)
{
if (rhs is null)
{
return null;
}
MyClass result = new MyClass(value + rhs.
On Thursday, 18 October 2012 at 18:31:09 UTC, Sean Kelly wrote:
On Oct 17, 2012, at 11:29 PM, Joshua Niehus
void foo(Tid tid) {
send(tid, true);
}
/* snip */
spawn() shouldn't allow you to spawn a delegate. Last I
checked (which was admittedly a while ago), there were some
compiler issues
On Thursday, 18 October 2012 at 06:30:08 UTC, Joshua Niehus wrote:
Is the following snippet a bug?
---
import core.thread;
import std.stdio, std.concurrency;
void foo(Tid tid) {
send(tid, true);
}
void main() {
auto fooTid = spawn(&foo, thisTid);
auto receiveInt = receiveTimeout(du
Is there an equivalent to std.range.chunks that will work on a
char array? As in, it will return a range iterating over chunks
of code points?
On Sunday, 7 October 2012 at 19:42:18 UTC, Ali Çehreli wrote:
What version of Phobos are you using? The source code of Phobos
that comes with dmd 2.060 does not have the definition that you
have shown.
In any case, according to the docs, it is SList that allows
setting the front element, not
The docs for std.container suggest I should be able to do this:
import std.container;
void main()
{
auto list = DList!int([1,2,3,4,5]);
list.front = 3;
}
But this does not compile (not a property list.front). I can't
figure out why this doesn't work though - the source for struct
DList(T)
On Sunday, 7 October 2012 at 01:14:48 UTC, Jonathan M Davis
wrote:
Regardless, it's a bug that normal remove doesn't work with the
result of take.
I guess this is also true of insertAfter and co? Should they
accept the result of take? (Currently they don't)
On Sunday, 7 October 2012 at 02:54:44 UTC, Jonathan M Davis wrote:
On Sunday, October 07, 2012 04:14:58 cal wrote:
On Sunday, 7 October 2012 at 01:14:48 UTC, Jonathan M Davis
wrote:
> The correct way is to use find combined with take (which is
> what you're doing,
> except t
On Sunday, 7 October 2012 at 01:14:48 UTC, Jonathan M Davis wrote:
The correct way is to use find combined with take (which is
what you're doing,
except that you're not using find). So, something like this
should work
void main()
{
auto list = DList!int([1,2,3,4]);
list.remove(find(lis
On Saturday, 6 October 2012 at 21:39:29 UTC, cal wrote:
I'd like to remove a single element from a std.container.DList.
For that I need a range, but I'm not sure how to get a single
element 'range'.
I thought something like this might work:
auto list = DList!int([1,2,
I'd like to remove a single element from a std.container.DList.
For that I need a range, but I'm not sure how to get a single
element 'range'.
I thought something like this might work:
auto list = DList!int([1,2,3,4]);
auto r = list[];
while(r.front != 3)
r.popFront;
list.remove(r.take(1))
On Tuesday, 25 September 2012 at 02:17:53 UTC, bearophile wrote:
This line of code sorts two arrays in "lock step", according to
the items of the first array:
zip(first, second).sort!q{a[0] < b[0]}();
Tangential to your point, but I hadn't seen the q{} syntax used
before. Are there reasons t
On Tuesday, 18 September 2012 at 19:02:33 UTC, Andrei
Alexandrescu wrote:
On 9/18/12 1:36 PM, cal wrote:
Variant tries to mimic D's built-in rules for arithmetic
conversions but:
import std.variant, std.stdio;
void main()
{
auto v1 = Variant(4.5f);
auto v2 = Variant(3.5f);
writeln((
Variant tries to mimic D's built-in rules for arithmetic
conversions but:
import std.variant, std.stdio;
void main()
{
auto v1 = Variant(4.5f);
auto v2 = Variant(3.5f);
writeln((v1+v2).type()); // double
}
The reason is Variant doesn't try to convert to float in
opArithmetic (it's is eas
On Sunday, 16 September 2012 at 22:08:53 UTC, deed wrote:
Exactly. I couldn't remember seeing this error before.
I've only used the dsource Win32 bindings, because there is often
stuff missing from the phobos ones:
http://www.dsource.org/projects/bindings/wiki/WindowsApi
But I don't underst
On Sunday, 16 September 2012 at 17:38:35 UTC, deed wrote:
What does the nothrow stems from? Is this something new?
Isn't the real question why the wndProc function is expected to
be nothrow?
The change is from this commit 4 months ago:
2886846a92c45d92308756cf4c077ae13f0f8460
On Monday, 10 September 2012 at 03:30:25 UTC, Jonathan M Davis
wrote:
On Monday, September 10, 2012 05:01:05 cal wrote:
__traits(allMembers), I'd like to be able to detect if a given
member is an alias (and get the member that is aliased). Is
there a way to do this currently?
No. As f
When using __traits(allMembers), I'd like to be able to detect if
a given member is an alias (and get the member that is aliased).
Is there a way to do this currently?
I'm trying to link with a recent build of LLVM on windows. I
built LLVM 3.1 as a DLL using mingw, converted DLL to LIB with
implib, however the link fails with the error
C:\cal\D\dmd2\windows\bin\..\lib\snn.lib(printf) Offset FFAB9H
Record Type 00C3
Error 1: Previous Definition Diff
1 - 100 of 142 matches
Mail list logo