Hi Basile,
Thank you for your code, it allowed me to grasp a little bit more
about how to do things in D.
Vincent
On Monday, 7 November 2016 at 23:03:32 UTC, Picaud Vincent wrote:
I need:
1/ a way to detect compile-time constant vs "dynamic" values
/**
* Indicates if something is a value known at compile time.
*
* Params:
* V = The value to test.
* T = Optional, the expected value type.
*
On Monday, 7 November 2016 at 23:07:27 UTC, Picaud Vincent wrote:
typo...
auto capacity = max(0,(size_-1)*stride_+1);
To be more correct I have something like:
alias IntergralConstant!(int,0) Zero_c;
alias IntergralConstant!(int,1) One_c;
auto capacity = max(Zero_c,(size_-One_c)*stride_+One_c
typo...
auto capacity = max(0,(size_-1)*stride_+1);
On Monday, 7 November 2016 at 22:18:56 UTC, Jerry wrote:
On Monday, 7 November 2016 at 21:37:50 UTC, Picaud Vincent
wrote:
static if ( isIntegralConstant!(typeof(required_capacity())
)
{
}
else
{
}
}
Premature post send by error sorry Well something like:
static if ( isIntegralCons
On Monday, 7 November 2016 at 21:37:50 UTC, Picaud Vincent wrote:
static if ( isIntegralConstant!(typeof(required_capacity()) )
{
}
else
{
}
}
Premature post send by error sorry Well something like:
static if ( isIntegralConstant!(typeof(required_capacity()) )
ElementType[requir
On Monday, 7 November 2016 at 21:23:37 UTC, Picaud Vincent wrote:
On Monday, 7 November 2016 at 18:59:24 UTC, Jerry wrote:
On Monday, 7 November 2016 at 18:42:37 UTC, Picaud Vincent
wrote:
template isIntegralConstant(ANY)
{
enum bool
isIntegralConstant=__traits(identifier,ANY)=="IntegralCo
On Monday, 7 November 2016 at 18:59:24 UTC, Jerry wrote:
On Monday, 7 November 2016 at 18:42:37 UTC, Picaud Vincent
wrote:
template isIntegralConstant(ANY)
{
enum bool
isIntegralConstant=__traits(identifier,ANY)=="IntegralConstant";
}
A bit more elegant way of doing that would be:
enum
On Monday, 7 November 2016 at 18:42:37 UTC, Picaud Vincent wrote:
template isIntegralConstant(ANY)
{
enum bool
isIntegralConstant=__traits(identifier,ANY)=="IntegralConstant";
}
A bit more elegant way of doing that would be:
enum isIntegralConstant(T) = is(T : IntegralConstant!U, U...);
On Thursday, 27 October 2016 at 13:43:26 UTC, Steven
Schveighoffer wrote:
It depends on the size of the file and the expectation of
duplicate words. I'm assuming the number of words is limited,
so you are going to allocate far less data by duping on demand.
In addition, you may incur penalties
On 10/27/16 2:40 AM, Era Scarecrow wrote:
On Tuesday, 25 October 2016 at 14:40:17 UTC, Steven Schveighoffer wrote:
I will note, that in addition to the other comments, this is going to
result in corruption. Simply put, the buffer that 'line' uses is
reused for each line. So the string data used
On Tuesday, 25 October 2016 at 14:40:17 UTC, Steven Schveighoffer
wrote:
I will note, that in addition to the other comments, this is
going to result in corruption. Simply put, the buffer that
'line' uses is reused for each line. So the string data used
inside the associative array is going to
On 10/22/16 1:25 AM, Mark wrote:
Hello, Im a 3rd year Comp Sci student in Edmonton Alberta, Canada.
Ive learned how to use C, and dabbled in C++ in school. Im also in a Oop
course using Java.
I picked up the book The D Programming Language by Alexrei Alexandrescu
a few years ago.
Lately Im real
Dne 22.10.2016 v 11:04 Mike Parker via Digitalmars-d-learn napsal(a):
On Saturday, 22 October 2016 at 08:05:12 UTC, Daniel Kozak wrote:
uint[string] dictionary;
should be
uint[size_t] dictionary;
because size_t is 32bit on x86 system and 64bit on x86_64
and you are trying to put array length
On Saturday, 22 October 2016 at 08:05:12 UTC, Daniel Kozak wrote:
uint[string] dictionary;
should be
uint[size_t] dictionary;
because size_t is 32bit on x86 system and 64bit on x86_64
and you are trying to put array length to dictionary which is
size_t
I believe you meant:
size_t[string];
Dne 22.10.2016 v 07:41 Mark via Digitalmars-d-learn napsal(a):
Thanks for the fast reply.
That did work. But now the error is on the line:
dictionary[word] = newId;
I changed the value to 10, still errors. ??
everything else is as before.
thanks.
uint[string] dictionary;
should b
On Saturday, 22 October 2016 at 05:41:34 UTC, Mark wrote:
Thanks for the fast reply.
That did work. But now the error is on the line:
dictionary[word] = newId;
I changed the value to 10, still errors. ??
everything else is as before.
thanks.
For simple single file experiments lik
Thanks for the fast reply.
That did work. But now the error is on the line:
dictionary[word] = newId;
I changed the value to 10, still errors. ??
everything else is as before.
thanks.
On 22/10/2016 6:25 PM, Mark wrote:
Hello, Im a 3rd year Comp Sci student in Edmonton Alberta, Canada.
Ive learned how to use C, and dabbled in C++ in school. Im also in a Oop
course using Java.
I picked up the book The D Programming Language by Alexrei Alexandrescu
a few years ago.
Lately Im re
On Thu, 2015-08-20 at 20:01 +, tony288 via Digitalmars-d-learn
wrote:
>
[…]
> Now what I would like to know, how would I make this code more
> efficient? Which is basically the aim I'm trying to achieve.
>
> Any pointers would be really help full. Should I use
> concurrency/parallelism etc.
On Fri, 2015-08-21 at 01:22 +, Nicholas Wilson via Digitalmars-d
-learn wrote:
>
[…]
> Keep in mind java may be using green threads as opposed to kernel
> threads.
> The equivalent in D is a Fiber.
I believe Java itself hasn't used green threads in an awful long time:
Threads are mapped to k
On Friday, 21 August 2015 at 12:45:52 UTC, Kagamin wrote:
On Thursday, 20 August 2015 at 15:31:13 UTC, tony288 wrote:
So I wrong some code. But it seems the time to process a
shared struct & shared long is always the same. Regardless of
adding paddings.
Should it be different?
Hi
all thank
On Thursday, 20 August 2015 at 15:31:13 UTC, tony288 wrote:
So I wrong some code. But it seems the time to process a shared
struct & shared long is always the same. Regardless of adding
paddings.
Should it be different?
On Friday, 21 August 2015 at 02:44:50 UTC, Rikki Cattermole wrote:
On 8/21/2015 3:37 AM, Dejan Lekic wrote:
Keep in mind that in D everything is thread-local by default!
:)
For shared resources use __gshared or shared (although I do
not know for
sure whether shared works or not).
Note: share
On 8/21/2015 3:37 AM, Dejan Lekic wrote:
Keep in mind that in D everything is thread-local by default! :)
For shared resources use __gshared or shared (although I do not know for
sure whether shared works or not).
Note: shared is __gshared but with mutex's added.
On Thursday, 20 August 2015 at 20:01:58 UTC, tony288 wrote:
On Thursday, 20 August 2015 at 15:37:35 UTC, Dejan Lekic wrote:
[...]
Thanks, I changed the code and the previous one was already
using shared.
import std.stdio;
import core.time;
import core.thread;
[...]
Keep in mind java may b
On Thursday, 20 August 2015 at 15:37:35 UTC, Dejan Lekic wrote:
Keep in mind that in D everything is thread-local by default! :)
For shared resources use __gshared or shared (although I do not
know for sure whether shared works or not).
Thanks, I changed the code and the previous one was alrea
Keep in mind that in D everything is thread-local by default! :)
For shared resources use __gshared or shared (although I do not
know for sure whether shared works or not).
Am 06.02.2011 19:38, schrieb Jesse Phillips:
scottrick Wrote:
T[] rawRead(T)(T[] buffer);
I understand that T is generic type, but I am not sure of the
meaning of the (T) after the method name.
That T is defining the symbol to represent the generic type. It can have more
than one and D prov
scottrick:
> Where is the function 'format' defined?
You need to add at the top of the module:
import std.conv: format;
Or:
import std.conv;
> Also, what is that 'unittest' block? It compiles fine as is, but if I refer
> to format outside of
> unittest, it will not compile. Also, if I compil
Thanks, your post was very helpful. Two more questions (probably
related):
Where is the function 'format' defined? Also, what is that 'unittest'
block? It compiles fine as is, but if I refer to format outside of
unittest, it will not compile. Also, if I compile and run your
example, it doesn't
scottrick Wrote:
> T[] rawRead(T)(T[] buffer);
>
> I understand that T is generic type, but I am not sure of the
> meaning of the (T) after the method name.
That T is defining the symbol to represent the generic type. It can have more
than one and D provides other things like aliases... Another
spir:
> Out[] map (In, Out) (In[] source, Out delegate (In) f) {
> // (0)
...
> string hex (uint i) { return format("0x%03X", i); }
> uint[] decs = [1, 3, 9, 27, 81, 243, 729];
> auto hexes = map!(uint,string)(decs, &hex);
...
> (0) The func must be declared as delegate (instea
On 02/05/2011 06:26 PM, scottrick wrote:
Hi,
I am new to D. I am trying to write a binary file parser for a
project of mine and I thought it would be fun to try and learn a new
language at the same time. So I chose D! :D I have been
struggling however and have not been able to find very many
On Sun, 29 Mar 2009 17:43:51 +0200, torhu wrote:
> On 29.03.2009 17:04, chris wrote:
>> Alright so I'm not too familiar with building D or having to build
>> multiple files from the command line (Java usually takes care of that).
>> Basically I have a small game I put together as a test project.
Yea I just realized it follows the directory structure and not some
arbitrary system I made up.
Thanks for the .config info, I was just putting one together of
similar structure, this'll absolutely help.
Much appreciated
chris wrote:
Alright so I'm not too familiar with building D or having to build
multiple files from the command line (Java usually takes care of
that). Basically I have a small game I put together as a test
project. Here's the structure:
clo/clo.d
clo/Main.d
clo/common/GameState.d
clo is in mo
chris schrieb:
The file clo.d is in module clo; while GameState is in module
slo.common;
you probably mean it is in package clo.
Also thanks for the link, I was going to ask about .conf files.
>
You're welcome.
The file clo.d is in module clo; while GameState is in module
slo.common;
I just import clo; and import clo.common; when using stuff in either
of those files, I hope that's correct.
Also thanks for the link, I was going to ask about .conf files.
How do you import the modules?
You must specify the correct name, i.e. import clo.clo;
Oh and you should get familiar with the dsss.conf file.
This is the way you normally build your project.
http://www.dsource.org/projects/dsss/wiki/DSSSForSoftwareEngineers
On 29.03.2009 17:04, chris wrote:
Alright so I'm not too familiar with building D or having to build
multiple files from the command line (Java usually takes care of
that). Basically I have a small game I put together as a test
project. Here's the structure:
clo/clo.d
clo/Main.d
clo/common/Game
41 matches
Mail list logo