On 11/26/18 4:04 AM, Per Nordlöw wrote:
Why is there no
- __traits(isArray, T)
alongside
- __traits(isStaticArray, T) and
- __traits(isAssociativeArray, T)
Thanks for bringing this to my attention, Per.
The core idea is to have __traits "primitive and ugly" and std.traits
"convenient and
On 03/16/2018 03:52 PM, Nordlöw wrote:
On Saturday, 10 March 2018 at 21:31:41 UTC, ag0aep6g wrote:
auto forwardMap(alias fun, Ts ...)(Ts things)
{
import std.meta: aliasSeqOf, staticMap;
import std.range: iota;
import std.typecons: Tuple;
alias NewType(size_t i) =
On 1/14/18 4:59 PM, Nordlöw wrote:
On Sunday, 14 January 2018 at 21:57:37 UTC, Nordlöw wrote:
Note that __trait(isLvalue, this) cannot be used to detect whether
`this` is an l-value or an r-value, which I find strange.
Shall be
__traits(isRef, this)
That would be difficult because
On 12/03/2017 12:42 AM, Johan Engelen wrote:
On Friday, 1 December 2017 at 18:33:09 UTC, Ali Çehreli wrote:
On 12/01/2017 07:21 AM, Steven Schveighoffer wrote:
> On 12/1/17 4:29 AM, Johan Engelen wrote:
>> (Also, I would expect "popFront" to return the element
popped, but it
>> doesn't, OK...
On 5/10/17 3:40 PM, k-five wrote:
I have a line of code that uses "to" function in std.conv for a purpose
like:
int index = to!int( user_apply[ 4 ] ); // string to int
When the user_apply[ 4 ] has value, there is no problem; but when it is
empty: ""
it throws an ConvException exception and
On 12/5/16 3:49 PM, e-y-e wrote:
If you don't mind me saying, I think Mir could be one of the best things
for the future of D (along with LDC) and I'd be glad to help it on its way.
Yes, Mir is awesome! I keep on thinking of ways to make it better
supported by the language and infra. --
On 12/6/16 3:28 AM, Ilya Yaroshenko wrote:
On Tuesday, 6 December 2016 at 08:14:17 UTC, Andrea Fontana wrote:
On Monday, 5 December 2016 at 20:25:00 UTC, Ilya Yaroshenko
Phobos/Druntime are pretty good for a lot of projects.
In theory
And what seem to be the issues in practice with code
On 11/02/2016 11:07 AM, Nordlöw wrote:
On Wednesday, 2 November 2016 at 13:45:41 UTC, Nordlöw wrote:
Typically set- and map-like containers with O(1) key membership checking.
A typical use case is intersection of the two sets `x` and `y`.
When `x` and `y` both support O(1)-`contains(e)` the
On 10/06/2016 10:32 AM, Nordlöw wrote:
Is there a concept in D similar to Rust's `collect`:
https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.collect
That's "make" in std.container. Is that what you're looking for? As an
aside, "collect" is an awful abbreviation of "collection".
On 9/21/16 8:49 AM, Nordlöw wrote:
Is there any way to make a default constructor of a struct container
allocate/initialize an internal pointer?
I need this in a container with RC behaviour similar to
struct Container
{
this()// this is currently forbidden:
{
_rcStore =
On 5/21/15 2:35 PM, Ali Çehreli wrote:
On 05/21/2015 12:44 PM, Meta wrote:
All we need is user-defined opIs and then we're really cooking with gas.
if (5 is between(4, 6))
{
//...
}
We're almost there. :)
bool is_between(T0, T1, T2)(T0 what, T1 min, T2 max)
{
return (what = min)
On 1/18/15 10:19 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
On Sunday, January 18, 2015 23:21:43 jollie via Digitalmars-d-learn wrote:
Jonathan M Davis via Digitalmars-d-learn digita
lmars-d-le...@puremagic.com Wrote in message:
It's been a while since I did anything in Windows with
On 1/18/15 11:22 PM, Jonathan M Davis via Digitalmars-d-learn wrote:
It suggests creating an empty masm386.bat file in a directory which is in
your path (e.g. C:\dm\bin), and then it'll just work, since masm386 will do
nothing. Still, I'm inclined to think that the makefile should be fixed so
On 1/9/15 6:10 PM, Jesse Phillips wrote:
On Friday, 9 January 2015 at 13:50:29 UTC, eles wrote:
https://codegolf.stackexchange.com/questions/44278/debunking-stroustrups-debunking-of-the-myth-c-is-for-large-complicated-pro
Link to answer in D:
http://codegolf.stackexchange.com/a/44417/13362
On 6/26/14, 11:11 AM, Mark Isaacson wrote:
Managed to build it successfully I think, but have actually
returned to the problem that initially caused me to want to try
and build the library in the first place:
If I try to build a simple program:
import std.stdio;
import std.net.curl;
void
On 3/24/14, 4:55 PM, Dragos Carp wrote:
Any alternatives??
I moved cmaked2 to github [1], updated and simplified the usage a
little (system cmake patch not necessary anymore). You can give
it a try. Dub registry support is also on the way.
Regards
Dragos
[1] -
On 9/16/13 11:56 AM, Namespace wrote:
I hate this NotNull struct hack. It is the same crap as the current
scope solution.
Scoped variables in the language were a lot worse.
BTW: I'm curious which built-in feature will be removed
next, maybe AA?
If we're diligent and lucky, hopefully.
An
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 the default from virtual
methods to final methods.
Anything new? Anybody working on that? I
http://stackoverflow.com/questions/17235375/how-to-create-bindings-qml-to-d
Andrei
On 5/5/13 7:22 AM, bearophile wrote:
Splitting a range in two according to a predicate is a common
enough need. How do you translate this C++/STL idiom to D/Phobos?
vectorint source_data;
...
vectorint good_stuff, bad_stuff;
partition_copy(begin(source_data), end(source_data),
On 5/1/13 6:20 PM, Jesse Phillips wrote:
On Wednesday, 1 May 2013 at 22:33:40 UTC, John Colvin wrote:
On Wednesday, 1 May 2013 at 21:26:32 UTC, Temtaime wrote:
Because it's full of a drawing and many other functions. OpenGL is
part of WinAPI.
Is that strictly speaking true? I didn't think
On 4/22/13 5:52 PM, bearophile wrote:
Andrei Alexandrescu:
c) add introspection to the algorithm, i.e. if an attempt to partition
hits the worst case or near worst case, just try another pivot instead
of moving forward with the sorting stage.
Or switch to a sort that is guaranteed to have
On 4/19/13 6:37 PM, Ivan Kazmenko wrote:
That [SwapStrategystable] uses the TimSort that contains
the optimization you look for.
alias mySort = sort!(a b, SwapStrategy.stable);
Thank you, these are good for now.
A seemingly easy way to provide the choice globally would be to have an
On 3/14/13 6:45 AM, Andrea Fontana wrote:
On Thursday, 14 March 2013 at 10:08:53 UTC, Andrea Fontana wrote:
I'm trying to implement a db cursor as simple InputRange. I can't
implement as forward range because using c-api I can't clone/save cursor.
I wrote popFront() front() and empty() method
On 3/8/13 1:34 PM, Chris Cain wrote:
On Friday, 8 March 2013 at 18:17:22 UTC, bearophile wrote:
auto firstDistinct(Range)(Range r, in size_t n) {
bool[ForeachType!Range] mySet;
return r.filter!((k) {
if (k in mySet)
return false;
mySet[k] = true;
return true;
}).take(n);
}
I have to say,
On 12/24/12 12:57 PM, Jonathan M Davis wrote:
On Monday, December 24, 2012 12:37:54 Andrei Alexandrescu wrote:
An important smoking gun is C++'s min(), which is allows writing unsafe
code without casts.
const int haveANiceDay = min(4, 5);
But what does that have to do with const
On 12/24/12 1:05 PM, monarch_dodra wrote:
On Monday, 24 December 2012 at 17:37:54 UTC, Andrei Alexandrescu wrote:
On 12/24/12 12:11 PM, Jonathan M Davis wrote:
On Monday, December 24, 2012 17:55:23 Minas Mina wrote:
On Sunday, 23 December 2012 at 23:59:55 UTC, Jonathan M Davis
wrote
On 12/24/12 1:20 PM, Jonathan M Davis wrote:
On Monday, December 24, 2012 22:11:58 Dmitry Olshansky wrote:
12/24/2012 9:57 PM, Jonathan M Davis пишет:
On Monday, December 24, 2012 12:37:54 Andrei Alexandrescu wrote:
An important smoking gun is C++'s min(), which is allows writing unsafe
code
On 12/24/12 1:49 PM, Jonathan M Davis wrote:
On Monday, December 24, 2012 13:45:10 Andrei Alexandrescu wrote:
The very binding of rvalues to const ref would allow that breakage. We
can't allow that to happen.
But it's only bound for the length of the statement. After that, the binding
can
On 12/24/12 2:46 PM, anonymous wrote:
On Monday, 24 December 2012 at 18:50:12 UTC, Jonathan M Davis wrote:
const int i = foo(bar(min(5, 7)));
which would allow a reference to be kept around, which D disallows.
Does it?
const(int)* i = foo(bar(min(5, 7)));
We plan to forbid that.
Andrei
On 10/30/12 4:17 PM, Tobias Pankrath wrote:
On Tuesday, 30 October 2012 at 20:16:12 UTC, Tobias Pankrath
wrote:
In the meantime you can use this function template to compare structs
field by field.
bool oneStepEqual(T,F)(ref T lhs, ref F rhs)
if(is(Unqual!T == Unqual!F) is(T == struct))
{
On 10/23/12 11:36 AM, mist wrote:
Was thinking on this topic after seeing this:
http://stackoverflow.com/questions/13014999/cannot-slice-taker-from-std-range-in-d
Still can't understand rationale here. Why native slicing / random
access is allowed for narrow strings, but trait explicitly
On 10/23/12 12:35 PM, Andrei Alexandrescu wrote:
On 10/23/12 11:58 AM, mist wrote:
On Tuesday, 23 October 2012 at 15:55:23 UTC, Andrei Alexandrescu wrote:
On 10/23/12 11:36 AM, mist wrote:
Was thinking on this topic after seeing this:
http://stackoverflow.com/questions/13014999/cannot-slice
On 10/23/12 11:58 AM, mist wrote:
On Tuesday, 23 October 2012 at 15:55:23 UTC, Andrei Alexandrescu wrote:
On 10/23/12 11:36 AM, mist wrote:
Was thinking on this topic after seeing this:
http://stackoverflow.com/questions/13014999/cannot-slice-taker-from-std-range-in-d
Still can't understand
On 10/17/12 3:07 PM, Philippe Sigaud wrote:
On Mon, Oct 15, 2012 at 5:52 PM, Andrei Alexandrescu
seewebsiteforem...@erdani.org wrote:
I wanted to investigate small sorts using sorting networks for ages, but
never got around to it. That's important for quicksort because it produces
many small
On 10/15/12 8:11 AM, Philippe Sigaud wrote:
On Mon, Oct 15, 2012 at 1:04 PM, Era Scarecrowrtcv...@yahoo.com wrote:
On Monday, 15 October 2012 at 09:18:12 UTC, Era Scarecrow wrote:
So an example area to be sorted with 16 elements would take on average
about 100 compares while theoretically
On 10/10/12 5:35 AM, denizzzka wrote:
It is up to 131072 digits before the decimal point; up to 16383 digits
after the decimal point.
For now, I guess string would be it.
Andrei
On 10/9/12 12:30 PM, Faux Amis wrote:
On a side-note, why is rdmd picky about argument order?
dmd test.d -I..\include
Because anything after the program is considered an argument to the program.
Andrei
On 10/9/12 4:38 PM, Andrej Mitrovic wrote:
On 10/9/12, Andrei Alexandrescuseewebsiteforem...@erdani.org wrote:
On 10/9/12 12:30 PM, Faux Amis wrote:
On a side-note, why is rdmd picky about argument order?
dmd test.d -I..\include
Because anything after the program is considered an
On 10/7/12 5:15 AM, Jonathan M Davis wrote:
On Sunday, October 07, 2012 10:09:06 Russel Winder wrote:
Removal from a singly-linked list can be O(1) as well, it depends
whether you are deleting using an iterator in progress.
IIRC that dcollections' singly-linked list is like this, but
On 10/6/12 4:48 PM, ref2401 wrote:
is there any Phobos function to calculate the next power of 2 of the
specified number?
Use 1U bsr(x).
http://dlang.org/phobos/core_bitop.html#bsr
Andrei
On 10/6/12 4:57 PM, Dmitry Olshansky wrote:
On 07-Oct-12 00:54, Dmitry Olshansky wrote:
On 07-Oct-12 00:48, ref2401 wrote:
is there any Phobos function to calculate the next power of 2 of the
specified number?
No though it's reinvented in a couple of places I think.
Anyway this should work
On 10/6/12 4:54 PM, Dmitry Olshansky wrote:
On 07-Oct-12 00:48, ref2401 wrote:
is there any Phobos function to calculate the next power of 2 of the
specified number?
No though it's reinvented in a couple of places I think.
Anyway this should work for unsigned numbers:
import core.bitop;
T
On 9/26/12 9:50 AM, monarch_dodra wrote:
struct S{};
is(typeof(takeExactly(S, 1)) == S) //false
is(S == typeof(takeExactly(S, 1))) //Error: template
std.range.takeExactly does not match any function template declaration
Neither should work. The expression should be takeExactly(S.init, 1).
On 9/23/12 8:47 AM, Timon Gehr wrote:
import std.range, std.traits;
import std.stdio;
template Hello(R) if(is(typeof(R._input.takeExactly(2)) == R)){
alias R Hello;
}
That's the nicest. Regarding availability of _input, I meant to make
it available systematically as input for ranges where the
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((v1+v2).type()); // double
}
The reason is Variant doesn't try to convert to float in
On 8/29/12 3:47 PM, Charles Hixson wrote:
Where should I look to better understand
rdmd? I expected to need to list all the local files that were needed,
but clearly that's the wrong approach.
http://dlang.org/rdmd.html
To my surprise, it's not in the top Google search results. However,
On 8/29/12 4:52 PM, Charles Hixson wrote:
On 08/29/2012 04:15 PM, Andrei Alexandrescu wrote:
On 8/29/12 3:47 PM, Charles Hixson wrote:
Where should I look to better understand
rdmd? I expected to need to list all the local files that were needed,
but clearly that's the wrong approach.
http
On 8/2/12 5:14 AM, Era Scarecrow wrote:
On Thursday, 2 August 2012 at 09:03:54 UTC, monarch_dodra wrote:
I had an (implementation) question for you: Does the implementation
actually require knowing what the size of the padding is?
eg:
struct A
{
int a;
mixin(bitfields!(
uint, x, 2,
int, y, 3,
On 8/2/12 5:26 AM, monarch_dodra wrote:
One of the *big* reasons I'm against having a hand chosen padding, is
that the implementation *should* be able to find out what the most
efficient padding is on the current machine (could be 32 on some, could
be 64 on some)
In my neck of the woods they
On 8/2/12 9:48 AM, monarch_dodra wrote:
On Thursday, 2 August 2012 at 12:38:10 UTC, Andrei Alexandrescu wrote:
On 8/2/12 5:26 AM, monarch_dodra wrote:
One of the *big* reasons I'm against having a hand chosen padding, is
that the implementation *should* be able to find out what the most
51 matches
Mail list logo