On Sunday, 7 June 2015 at 10:23:22 UTC, Rikki Cattermole wrote:
Don't worry about collecting at the end. The OS will clean up
the app no matter what.
Actually D runtime will also do a collection before exiting. This
is why it shows "Number of collections: 2" above. One triggered
manually, on
On Monday, June 08, 2015 13:51:18 Mike Parker via Digitalmars-d-learn wrote:
> On 6/8/2015 12:43 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
> > On Monday, June 08, 2015 00:42:07 Mike Parker via Digitalmars-d-learn wrote:
> >> When implementing a custom range, is it correct to say that
> >>
Just a recap. Here's the final fix. Thanks to Anonymous and Adam.
int arrayByteSize(T)(T someArray) if (isDynamicArray!(T))
{
ubyte[] arr = cast(ubyte[]) someArray;
return arr.length;
}
float[] dynamicArray = [1.1, 3.0, 1.0, 7.3];
sizeInBytes = arrayByteSize(dynamicArray);
lengthInEle
On 6/8/2015 12:43 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Monday, June 08, 2015 00:42:07 Mike Parker via Digitalmars-d-learn wrote:
When implementing a custom range, is it correct to say that
consecutive calls to r.front with no intervening calls to
popFront should return the same
On Monday, 8 June 2015 at 04:02:26 UTC, WhatMeWorry wrote:
On Sunday, 7 June 2015 at 23:13:14 UTC, anonymous wrote:
On Sunday, 7 June 2015 at 23:08:02 UTC, WhatMeWorry wrote:
However, when I try to add a simple constraint to the
function like so:
int arrayByteSize(T)(T[] someArray) if (isDyna
The easiest way is to not use search paths, and instead pass all
the modules you want compiled to the compiler directly. Then it
will look for the module name declaration instead of the
directory/filename layout.
On Monday, 8 June 2015 at 04:02:26 UTC, WhatMeWorry wrote:
Why would a working function call stop working just because a
constraint was added to the function?
because T is float... which isn't a dynamic array, so the
constraint doesn't match. Just remove the [] after T[] in your
signature and
ping?
On Sun, Mar 15, 2015 at 10:26 PM, Timothee Cour
wrote:
> Is there a way to exclude current directory from search path in dmd, so
> that the search path is only given by '-I' arguments (+ones from dmd.conf)?
>
> use case:
>
> files:
> /base/foo.d
> /base/bar/foo.d
> /base/bar/main.d #contai
On Sunday, 7 June 2015 at 23:13:14 UTC, anonymous wrote:
On Sunday, 7 June 2015 at 23:08:02 UTC, WhatMeWorry wrote:
However, when I try to add a simple constraint to the function
like so:
int arrayByteSize(T)(T[] someArray) if (isDynamicArray(T))
You forgot an exclamation mark here. Make tha
On Monday, June 08, 2015 00:42:07 Mike Parker via Digitalmars-d-learn wrote:
> When implementing a custom range, is it correct to say that
> consecutive calls to r.front with no intervening calls to
> popFront should return the same value? Seems like I read
> something along those lines before, but
On Sunday, 7 June 2015 at 23:13:14 UTC, anonymous wrote:
int arrayByteSize(T)(T[] someArray) if (isDynamicArray(T))
You forgot an exclamation mark here. Make that:
isDynamicArray!(T)
Also, if you pass int[] to that function, for example, T will
*not* be int[] - it will actually be int.
(T
On Sunday, 7 June 2015 at 16:25:29 UTC, Oleg B wrote:
auto myalloc(T)( size_t count )
{
struct Impl{ size_t len; void* ptr; }
union Wrap { Impl impl; T[] arr; }
auto ret = Wrap( Impl( count, calloc( count, T.sizeof ) )
).arr;
enforce( ret.ptr !is null );
return ret;
}
No
On Monday, 8 June 2015 at 01:29:19 UTC, Dennis Ritchie wrote:
Here is how it is implemented in the book of Andrew:
Sorry, *Andrei.
On Monday, 8 June 2015 at 01:15:30 UTC, Mike Parker wrote:
I know how to use a range :) What I'm asking about is a
requirement on implementing front on a custom range. Is there a
rule that says when I implement my own range, consecutive calls
to front must return the same value until popFront i
On 6/8/2015 9:55 AM, Dennis Ritchie wrote:
On Monday, 8 June 2015 at 00:42:12 UTC, Mike Parker wrote:
When implementing a custom range, is it correct to say that
consecutive calls to r.front with no intervening calls to popFront
should return the same value?
Yes. For examle:
import std.stdio,
The foreach loop takes place in a for loop like this:
import std.range;
for (auto __c = 5.iota; !__c.empty; __c.popFront) {
auto elem = __c.front;
}
On Monday, 8 June 2015 at 00:42:12 UTC, Mike Parker wrote:
When implementing a custom range, is it correct to say that
consecutive calls to r.front with no intervening calls to
popFront should return the same value?
Yes. For examle:
import std.stdio, std.range;
template foo(T) {
auto foo
When implementing a custom range, is it correct to say that
consecutive calls to r.front with no intervening calls to
popFront should return the same value? Seems like I read
something along those lines before, but I can't find it anywhere.
On Sunday, 7 June 2015 at 23:08:02 UTC, WhatMeWorry wrote:
However, when I try to add a simple constraint to the function
like so:
int arrayByteSize(T)(T[] someArray) if (isDynamicArray(T))
You forgot an exclamation mark here. Make that: isDynamicArray!(T)
Should be real simple. But adding a small template constraint
causes compile failure. I've got the following working code:
int arrayByteSize(T)(T[] someArray)
{
ubyte[] arr = cast(ubyte[]) someArray;
return arr.length;// length is implicitly converted
to bytes.
}
// running t
On 06/07/2015 02:11 PM, Jonathan Villa wrote:
Is that the info you're asking for? If not, please tell me.
Yes, that's the info people who will help you are looking for. (I don't
know the answer. :) )
Ali
On Sunday, 7 June 2015 at 19:17:51 UTC, Ali Çehreli wrote:
On 06/06/2015 05:38 PM, Jonathan Villa wrote:
(and the linking line, if separate)?
Ali
I did a little research, and I think you're looking for a line
like:
link.exe
there isn't a link.exe call at compilation time.
On Sunday, 7 June 2015 at 19:17:51 UTC, Ali Çehreli wrote:
Could it be a linking issue? What is the exact compilation line
(and the linking line, if separate)?
Ali
Compilation line:
Current dictionary: C:\Users\JVortex\Documents\Projects\DataTable2
dmd.exe -O -release "DataBlockHeader.d"
On Sunday, 7 June 2015 at 19:11:25 UTC, anonymous wrote:
On Sunday, 7 June 2015 at 19:04:08 UTC, Dennis Ritchie wrote:
auto rbt = redBlackTree!("a <= b", int)(1, 2, 3, 4, 5);
writeln(rbt.upperBound(3)); // prints [3, 4, 5]
How do I do with the comparator "a < b" ?
Use equalRange to get the el
On 06/06/2015 05:38 PM, Jonathan Villa wrote:
> Hello everyone!
>
> I've been starting to use D but some compilation issues appears.
> The proyect is just a class library made in Xamarin Studio and just
> contains 3 classes.
>
> At compilation time it throws 7 errors:
> Error: object.Object.opEqu
On Sunday, 7 June 2015 at 19:04:08 UTC, Dennis Ritchie wrote:
OK. But I want to return a `upperBound` segment with the
included `key`. It does not suit me:
auto rbt = redBlackTree!("a < b", int)(1, 2, 3, 4, 5);
writeln(rbt.upperBound(3)); // prints [4, 5]
I want it to be so:
auto rbt = redBla
On Sunday, 7 June 2015 at 18:50:47 UTC, anonymous wrote:
On Sunday, 7 June 2015 at 18:42:58 UTC, Dennis Ritchie wrote:
How do I remove the key from the `redBlackTree` with
comparator "a <= b" ?
Do not use '<=' as a comparison function with RedBlackTree. It
doesn't meet the requirements.
Quo
On Sunday, 7 June 2015 at 18:42:58 UTC, Dennis Ritchie wrote:
How do I remove the key from the `redBlackTree` with comparator
"a <= b" ?
Do not use '<=' as a comparison function with RedBlackTree. It
doesn't meet the requirements.
Quoting the documentation [1]:
Note that less should produce
I understand that `removeKey` works only with the comparator "a <
b":
http://dlang.org/phobos/std_container_rbtree.html#.RedBlackTree.removeKey
Removes elements from the container that are equal to the given
values according to the less comparator.
How do I remove the key from the `redBlackTre
On Saturday, 6 June 2015 at 18:43:08 UTC, Marc Schütz wrote:
_d_arraybounds() always throws an error because that's its
purpose. It's implemented here:
https://github.com/D-Programming-Language/druntime/blob/master/src/core/exception.d#L640
My point was that _d_arraybounds never returns, inst
Hi, everybody!
DMD32 D Compiler v2.067.0
I try to cause the fputc function from CrtDLL.DLL and I receive a
mistake. Why?
import core.runtime; // Загрузка DLL Для Win
import std.stdio;// writeln
version(Windows) {
import std.c.windows.windows; // GetProcAddress для Windows
No just reserve some memory and preallocate the buffer you want
before using it. It'll be a lot faster and cheaper.
I know, it's only for test.
You shouldn't be using delete or new for that matter.
You should be using malloc + free. And emplace.
auto myalloc(T)( size_t count )
{
struct Im
On Sunday, 7 June 2015 at 15:17:27 UTC, 1967 wrote:
I've got a template that takes in a type. Sometimes the type is
a class, sometimes a struct, sometimes just an int. It doesn't
much matter what it is, but if it's a reference type I need to
check if it's null so I can make it not null before u
On 06/07/2015 05:56 AM, Dennis Ritchie wrote:
On Sunday, 7 June 2015 at 12:42:12 UTC, Nicholas Wilson wrote:
On Sunday, 7 June 2015 at 12:30:12 UTC, Dennis Ritchie wrote:
try using a pure function + static e.g.
int[][int][int] somePureDefaultHash() pure
{
... //initialise it here
}
...
st
I've got a template that takes in a type. Sometimes the type is a
class, sometimes a struct, sometimes just an int. It doesn't much
matter what it is, but if it's a reference type I need to check
if it's null so I can make it not null before using it. I get an
error if I try to check if a value
On Sunday, 7 June 2015 at 12:28:37 UTC, ParticlePeter wrote:
On Sunday, 7 June 2015 at 12:12:16 UTC, Rikki Cattermole wrote:
On 7/06/2015 11:53 p.m., ParticlePeter wrote:
Wow, sometimes tough to find a good subject and issue
description.
I am working on a dynamic binding to the mantle32.dll
fo
On Sunday, 7 June 2015 at 12:30:40 UTC, Adam D. Ruppe wrote:
For the Invoke call, you should be able to just ignore most the
arguments and write something like
listview.invoke( delegate Object(Object[]) {
listview.Add(whatever);
return null;
});
and it should work.
Hello Adam, thanks
On Sunday, 7 June 2015 at 12:43:17 UTC, Nicholas Wilson wrote:
or enum
I suspect that enum can not add elements to the array.
On Sunday, 7 June 2015 at 12:42:12 UTC, Nicholas Wilson wrote:
On Sunday, 7 June 2015 at 12:30:12 UTC, Dennis Ritchie wrote:
try using a pure function + static e.g.
int[][int][int] somePureDefaultHash() pure
{
... //initialise it here
}
...
static hash = somePureDefaultHash();
static int
On Sun, Jun 07, 2015 at 12:43:16PM +, Nicholas Wilson via
Digitalmars-d-learn wrote:
> On Sunday, 7 June 2015 at 12:42:12 UTC, Nicholas Wilson wrote:
> >On Sunday, 7 June 2015 at 12:30:12 UTC, Dennis Ritchie wrote:
> >>Does D the ability to add items to arrays and hashes at compile
> >>time?
>
On Sunday, 7 June 2015 at 12:42:12 UTC, Nicholas Wilson wrote:
On Sunday, 7 June 2015 at 12:30:12 UTC, Dennis Ritchie wrote:
Does D the ability to add items to arrays and hashes at
compile time?
For example, how do I do it in compile time?:
int[][int][int] hash;
hash[4][6] ~= [34, 65];
hash[
On Sunday, 7 June 2015 at 12:30:12 UTC, Dennis Ritchie wrote:
Does D the ability to add items to arrays and hashes at compile
time?
For example, how do I do it in compile time?:
int[][int][int] hash;
hash[4][6] ~= [34, 65];
hash[5][7] ~= [4, 78, 21];
try using a pure function + static e.g.
For the Invoke call, you should be able to just ignore most the
arguments and write something like
listview.invoke( delegate Object(Object[]) {
listview.Add(whatever);
return null;
});
and it should work.
Does D the ability to add items to arrays and hashes at compile
time?
For example, how do I do it in compile time?:
int[][int][int] hash;
hash[4][6] ~= [34, 65];
hash[5][7] ~= [4, 78, 21];
On Sunday, 7 June 2015 at 12:12:16 UTC, Rikki Cattermole wrote:
On 7/06/2015 11:53 p.m., ParticlePeter wrote:
Wow, sometimes tough to find a good subject and issue
description.
I am working on a dynamic binding to the mantle32.dll following
DerelictGL and DerelictCl.
Functions in the mantle dll
Hello,
I couldn't find a DFL subforum so I decided to post here, I
apologize in advance if this isn't the right place.
I'm currently using DFL to write a Youtube downloading program
with a simple GUI. I chose DFL because I enjoy the Entice
Designer WYSIWYG capabilities, but also because I fo
On 7/06/2015 11:53 p.m., ParticlePeter wrote:
Wow, sometimes tough to find a good subject and issue description.
I am working on a dynamic binding to the mantle32.dll following
DerelictGL and DerelictCl.
Functions in the mantle dll use structs as argument types. I would like
to define those struc
On Sunday, 7 June 2015 at 11:33:56 UTC, Marc Schütz wrote:
Not true:
immutable y = 1;
enum x = &y;
You can even do pointer arithmetics:
auto foo() {
auto x = [1,2,3,4];
auto y = &x[1];
return y[2];
}
pragma(msg, foo());
Then I do not see any proble
Wow, sometimes tough to find a good subject and issue description.
I am working on a dynamic binding to the mantle32.dll following
DerelictGL and DerelictCl.
Functions in the mantle dll use structs as argument types. I
would like to define those structs in a module
derelict.mantle.types ( as in
On Sun, 07 Jun 2015 11:37:29 +, Marc Schütz wrote:
> On Sunday, 7 June 2015 at 06:20:55 UTC, ketmar wrote:
>> On Sun, 07 Jun 2015 05:32:46 +, Tofu Ninja wrote:
>>
>>> Whats the idiomatic way to check if an identifier has a specific UDA
>>> attached to it.
>>>
>>> Also what should I use t
On Sunday, 7 June 2015 at 06:20:55 UTC, ketmar wrote:
On Sun, 07 Jun 2015 05:32:46 +, Tofu Ninja wrote:
Whats the idiomatic way to check if an identifier has a
specific UDA
attached to it.
Also what should I use to define a UDA that doesn't need to
carry any
data? Just an empty template?
On Sunday, 7 June 2015 at 03:04:38 UTC, lobo wrote:
On Sunday, 7 June 2015 at 03:01:15 UTC, lobo wrote:
On Saturday, 6 June 2015 at 17:06:37 UTC, Dennis Ritchie wrote:
[snip]
`static if(5 in hash) {}` will not work because (5 in hash)
returns a pointer to the value or null if the key oesn't
On Sunday, 7 June 2015 at 09:00:29 UTC, Dennis Ritchie wrote:
On Sunday, 7 June 2015 at 02:38:57 UTC, lobo wrote:
If anyone knows why the proposal claims to be so different
from D's static-if (modulo the restrictions mentioned) I'd be
interested to know why.
http://forum.dlang.org/post/mke22o
SetCursor?
https://msdn.microsoft.com/en-us/library/windows/desktop/ms648393%28v=vs.85%29.aspx
On 7/06/2015 10:16 p.m., Oleg B wrote:
Hello. I want to try use D without GC and I'm not sure what I do all right.
import core.memory;
version( gcdis ) enum gc_disable = true;
else enum gc_disable = false;
class Foo
{
byte[][] buf;
this()
{
foreach( i; 0 ..
Hello. I want to try use D without GC and I'm not sure what I do
all right.
import core.memory;
version( gcdis ) enum gc_disable = true;
else enum gc_disable = false;
class Foo
{
byte[][] buf;
this()
{
foreach( i; 0 .. 32 )
buf ~= new byte[]( 65536 *
On Sunday, 7 June 2015 at 02:38:57 UTC, lobo wrote:
If anyone knows why the proposal claims to be so different from
D's static-if (modulo the restrictions mentioned) I'd be
interested to know why.
http://forum.dlang.org/post/mke22o$2l9i$1...@digitalmars.com
On Sunday, 7 June 2015 at 03:04:38 UTC, lobo wrote:
On Sunday, 7 June 2015 at 03:01:15 UTC, lobo wrote:
On Saturday, 6 June 2015 at 17:06:37 UTC, Dennis Ritchie wrote:
[snip]
`static if(5 in hash) {}` will not work because (5 in hash)
returns a pointer to the value or null if the key oesn't
58 matches
Mail list logo