On Tue, 12 Aug 2014 06:21:17 +
uri via Digitalmars-d-learn wrote:
> Hi,
>
> I'm trying to allow implicit conversions for my own type
> happening. I have the following:
>
>
> import std.math;
> import std.traits;
>
> struct S(T)
> if(isFloatingPoint!T)
> {
> T val;
> alias val t
Hi,
I'm trying to allow implicit conversions for my own type
happening. I have the following:
import std.math;
import std.traits;
struct S(T)
if(isFloatingPoint!T)
{
T val;
alias val this;
}
void main()
{
auto s = S!float();
assert(isNaN(s));
s = 10.0;
assert(!is
Sorry should add this is on 2.066.0-rc2 and it used to work on
2.064.
Cheers,
uri
On Tuesday, 12 August 2014 at 06:21:19 UTC, uri wrote:
Hi,
I'm trying to allow implicit conversions for my own type
happening. I have the following:
import std.math;
import std.traits;
struct S(T)
if(is
On Monday, 11 August 2014 at 13:00:27 UTC, John Colvin wrote:
alias Parent = TypeTuple!(__traits(parent, foo!float))[0];
Say hello to optional parens - you are trying to call foo!float()
here and apply result to trait.
On Monday, 11 August 2014 at 22:24:28 UTC, Brian Schott wrote:
On Monday, 11 August 2014 at 22:20:54 UTC, Brian Schott wrote:
On Monday, 11 August 2014 at 19:47:46 UTC, Klaus wrote:
I mean when writing a D lexer, you necessarly reach the
moment when you think:
"Oh no! is this feature just her
On Monday, 11 August 2014 at 22:56:27 UTC, Klaus wrote:
On Monday, 11 August 2014 at 22:24:28 UTC, Brian Schott wrote:
On Monday, 11 August 2014 at 22:20:54 UTC, Brian Schott wrote:
On Monday, 11 August 2014 at 19:47:46 UTC, Klaus wrote:
I mean when writing a D lexer, you necessarly reach the
On Monday, 11 August 2014 at 22:20:54 UTC, Brian Schott wrote:
On Monday, 11 August 2014 at 19:47:46 UTC, Klaus wrote:
I mean when writing a D lexer, you necessarly reach the moment
when you think:
"Oh no! is this feature just here to suck ?"
They are and they do.
Also, use this: https://g
On Monday, 11 August 2014 at 19:47:46 UTC, Klaus wrote:
I mean when writing a D lexer, you necessarly reach the moment
when you think:
"Oh no! is this feature just here to suck ?"
They are and they do.
I use
auto pipes = pipeProcess( cmd, Redirect.stdout |
Redirect.stderr );
to redirect stdout of the newly created subprocess via pipes to a
file. The redirect itself happens in a newly created thread
(because I need to wait for the subprocess to finish to take the
exact elapsed time
On Monday, 11 August 2014 at 15:30:30 UTC, Justin Whear wrote:
1. http://dlang.org/phobos/std_bitmanip.html#.FloatRep
I'm lacking a use case. See
http://dlang.org/library/std/bitmanip/FloatRep.html
Is unsafe
*(cast(FloatRep*)&float_instance)
the only way to use this?
On Monday, 11 August 2014 at 15:30:30 UTC, Justin Whear wrote:
1. http://dlang.org/phobos/std_bitmanip.html#.FloatRep
Great! Thx.
On Monday, 11 August 2014 at 15:37:29 UTC, Dominikus Dittes
Scherkl wrote:
Should be patrs[1], he?
No, parts[1] contains a slice to the "e" separating the mantissa
from the exponent.
On Mon, Aug 11, 2014 at 10:58 PM, H. S. Teoh via Digitalmars-d-learn
wrote:
> In Flex, one way you can implement heredocs is to have a separate "mode"
> where the lexer is scanning for the ending string. So basically you
> have a sub-lexer that treats the heredoc as three tokens, one that
> defi
On Monday, 11 August 2014 at 20:10:47 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
On Mon, Aug 11, 2014 at 07:47:44PM +, Klaus via
Digitalmars-d-learn wrote:
I mean when writing a D lexer, you necessarly reach the moment
when
you think:
"Oh no! is this feature just here to suck ?"
I us
On Mon, Aug 11, 2014 at 10:50:34PM +0200, Philippe Sigaud via
Digitalmars-d-learn wrote:
> On Mon, Aug 11, 2014 at 10:09 PM, H. S. Teoh via Digitalmars-d-learn
> wrote:
> > On Mon, Aug 11, 2014 at 07:47:44PM +, Klaus via Digitalmars-d-learn
> > wrote:
> >> I mean when writing a D lexer, you
On Mon, Aug 11, 2014 at 10:09 PM, H. S. Teoh via Digitalmars-d-learn
wrote:
> On Mon, Aug 11, 2014 at 07:47:44PM +, Klaus via Digitalmars-d-learn wrote:
>> I mean when writing a D lexer, you necessarly reach the moment when
>> you think:
>>
>> "Oh no! is this feature just here to suck ?"
> T
On Mon, Aug 11, 2014 at 08:22:11PM +, Gary Willoughby via
Digitalmars-d-learn wrote:
[...]
> That..is..awesome! and much more simpler than i thought. I get it now,
> thanks. Is this pattern repeated in phobos?
This is essentially what byKey and byValue of the built-in associative
arrays do. :
On Monday, 11 August 2014 at 20:02:38 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
On Mon, Aug 11, 2014 at 07:35:04PM +, Gary Willoughby via
Digitalmars-d-learn wrote:
On Monday, 11 August 2014 at 18:20:51 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
>If you make your linked list contain
On Mon, Aug 11, 2014 at 07:47:44PM +, Klaus via Digitalmars-d-learn wrote:
> I mean when writing a D lexer, you necessarly reach the moment when
> you think:
>
> "Oh no! is this feature just here to suck ?"
I use heredocs every now and then when I need to embed long strings in
my program. It'
On Mon, Aug 11, 2014 at 07:35:04PM +, Gary Willoughby via
Digitalmars-d-learn wrote:
> On Monday, 11 August 2014 at 18:20:51 UTC, H. S. Teoh via
> Digitalmars-d-learn wrote:
> >If you make your linked list container the same thing as a range over
> >it, then iterating over the range will empty
I mean when writing a D lexer, you necessarly reach the moment
when you think:
"Oh no! is this feature just here to suck ?"
On Monday, 11 August 2014 at 18:20:51 UTC, H. S. Teoh via
Digitalmars-d-learn wrote:
If you make your linked list container the same thing as a
range over it, then iterating over the range will empty the
container as
well, which generally isn't what you want.
Yes but only if it's been impleme
Hi, I try to get why the last way of generating an interface
implementation fails. I've put assumptions: is it right ?
---
module itfgen;
import std.stdio;
interface itf{
void a_int(int p);
void a_uint(uint p);
}
template genimpl(T){
char[] genimpl(){
On Mon, Aug 11, 2014 at 05:51:11PM +, Gary Willoughby via
Digitalmars-d-learn wrote:
> Just for a bit a fun i've implemented a simple doubly linked list and
> trying out some range based stuff. Whilst doing so i have some
> questions which you guys might be able to answer.
>
> 1. In your opin
Just for a bit a fun i've implemented a simple doubly linked list
and trying out some range based stuff. Whilst doing so i have
some questions which you guys might be able to answer.
1. In your opinion when accessing the elements of a linked list
should they yield the data stored within the no
On Mon, 11 Aug 2014 12:51:40 +
via Digitalmars-d-learn wrote:
> Not the OS, but a special CPU instruction: isX86_64() in
> core.cpuid?
but there is ARM64 coming. and gdc, for example, will has no problems
to support it "out of the box" due to using gcc cogegen. yes, i know
that runtime shoul
On Monday, 11 August 2014 at 14:15:05 UTC, Nordlöw wrote:
Here's my current try:
string toMathML(T)(T x) @trusted /** pure */ if
(isFloatingPoint!T)
{
import std.conv: to;
import std.algorithm: findSplit; //
immutable parts = to!string(x).findSplit("e");
if (parts[2].length ==
On Mon, 11 Aug 2014 13:47:13 +, Nordlöw wrote:
> Is there a way to separately stringify/print the mantissa and exponent
> of a floating point?
>
> I want this in my pretty-printing module to produce something like
>
> 1.2 \cdot 10^3
>
> instead of
>
> 1.2e3
>
> I could of course always sp
Here's my current try:
string toMathML(T)(T x) @trusted /** pure */ if
(isFloatingPoint!T)
{
import std.conv: to;
import std.algorithm: findSplit; //
immutable parts = to!string(x).findSplit("e");
if (parts[2].length == 0)
return parts[0];
else
return parts[0
On Wednesday, 25 April 2012 at 21:43:11 UTC, Dmitry Olshansky
wrote:
On 25.04.2012 23:08, H. S. Teoh wrote:
Does std.regex support input ranges to match()? Or do I need
to convert
to string first?
For now, yes you have to convert them. Any random access range
of code units should do the tri
Is there a way to separately stringify/print the mantissa and
exponent of a floating point?
I want this in my pretty-printing module to produce something like
1.2 \cdot 10^3
instead of
1.2e3
I could of course always split on the e but that is kind of
non-elegant, I believe.
can someone talk me through the reasoning behind this:
import std.typetuple;
void foo(T)(T v){}
void foo(){}
version(ThisCompiles)
{
alias Parent = TypeTuple!(__traits(parent, foo))[0];
pragma(msg, __traits(getOverloads, Parent, "foo"));
// tuple()
}
else
{
alias Parent = TypeTuple
On Monday, 11 August 2014 at 07:58:15 UTC, Freddy wrote:
If you want to check if
the target OS(not your code) is running 32 vs 64 bit you have
to do system call for your target OS.
Not the OS, but a special CPU instruction: isX86_64() in
core.cpuid?
On Monday, 11 August 2014 at 05:19:01 UTC, Jeremy DeHaan wrote:
I am looking at these versions as described here:
http://dlang.org/version.html
There are X86 and X86_64 version identifiers, but these
specifically mention that they are versions for the processor
type. Can they also be used to
34 matches
Mail list logo