On Sunday, 11 March 2018 at 12:05:56 UTC, aliak wrote:
* aliasOf!int!"string" // multiple ! arguments are not allowed
* (aliasOf!int)!"string" // error c-style cast
* aliasOf!int.aliasOf!"string" // template isAliasOf(alias a)
does not have property 'isAliasOf
Yeah, that's a little hole in the
On Monday, 12 March 2018 at 03:13:08 UTC, Seb wrote:
Out of interest: I wonder what's your usecase for using qsort.
Or in other words: why you can't use the high-level
std.algorithm.sorting.sort?
This is only temporary. I will be using
std.algorithm.sorting.sort. I was converting a C program
On Monday, 12 March 2018 at 02:44:17 UTC, Joe wrote:
I saw the extern(C) and I believe I tried it before my previous
post, but dismissed it because I saw no difference in compiler
behavior.
Yeah, the compiler should just tell you what specifically it is
complaining about instead of making you
On Sunday, 11 March 2018 at 23:12:30 UTC, Joe wrote:
I'm getting a compiler error in a qsort() call as follows:
qsort(recs, num_recs, (Record *).sizeof, compar);
Record is a struct, recs is a fixed array of pointers to
Record's and num_recs is a size_t that holds the number of
valid recor
On Monday, March 12, 2018 02:11:49 Jordan Wilson via Digitalmars-d-learn
wrote:
> I wanted to iterate through a date range, so I initially tried:
> iota(Date(2016,1,1),Date(2018,1,1),dur!"days"(1));
>
> That wouldn't compile, which is fair enough I guess.
Maybe iota should be made to work, but as
On Monday, 12 March 2018 at 01:45:54 UTC, Adam D. Ruppe wrote:
I just reformatted it but now the difference should be visible:
`extern(C)` is missing on your callback.
The scope things might make a difference too, but I know for
sure extern(C) is necessary on your callback function.
I saw th
I wanted to iterate through a date range, so I initially tried:
iota(Date(2016,1,1),Date(2018,1,1),dur!"days"(1));
That wouldn't compile, which is fair enough I guess.
So I tried a for loop:
for (auto i = Date(2016,1,1); i < Date(2018,1,1);
i+=dur!"days"(1)){}
That seemed to work fine, but I
On Mon, Mar 12, 2018 at 01:04:06AM +, Joe via Digitalmars-d-learn wrote:
> On Sunday, 11 March 2018 at 23:26:04 UTC, Stefan Koch wrote:
> > You have to pass a pointer to the function.
> > Otherwise it'll be a parenthsis-less call.
> > use : qsort(recs, num_recs, (Record *).sizeof, &compar);
>
On Monday, 12 March 2018 at 01:04:06 UTC, Joe wrote:
and the latest error is:
D's error messages are so bad and shouldn't be hard to fix. It
kills me that basic every-day functionality like this isn't a
priority to the core devs. I even wrote a patch myself that would
call this out but it di
On Sunday, 11 March 2018 at 23:26:04 UTC, Stefan Koch wrote:
You have to pass a pointer to the function.
Otherwise it'll be a parenthsis-less call.
use : qsort(recs, num_recs, (Record *).sizeof, &compar);
After passing a pointer, getting some other error messages, I
changed the call to
On Sunday, 11 March 2018 at 23:12:30 UTC, Joe wrote:
I'm getting a compiler error in a qsort() call as follows:
qsort(recs, num_recs, (Record *).sizeof, compar);
Record is a struct, recs is a fixed array of pointers to
Record's and num_recs is a size_t that holds the number of
valid recor
I'm getting a compiler error in a qsort() call as follows:
qsort(recs, num_recs, (Record *).sizeof, compar);
Record is a struct, recs is a fixed array of pointers to Record's
and num_recs is a size_t that holds the number of valid records.
compar is this:
int compar(const void *p1, const
On Sunday, 11 March 2018 at 13:44:38 UTC, Basile B. wrote:
The first version works here:
```
template aliasOf(T) {
enum aliasOf(alias a) = is(typeof(a) == T);
}
string s;
pragma(msg, allSatisfy!(aliasOf!string, s, "string"));
```
I can see that my description was a little confusing, so
On Sunday, March 11, 2018 13:19:39 Mike Franklin via Digitalmars-d-learn
wrote:
> This works:
>
> ```
> class S {
> int n, m;
> int sum() { return n + m; }
> Inner!(sum) a;
>
> class Inner(alias f){
> auto get() {
> return f();
> }
> }
> }
>
On Sunday, March 11, 2018 08:39:54 aliak via Digitalmars-d-learn wrote:
> On Saturday, 10 March 2018 at 23:00:07 UTC, Jonathan M Davis
> > issue in practice. That doesn't mean that it's never a problem,
> > but from what I've seen, it's very rarely a problem, and it's
> > easy to work around if you
On Sunday, 11 March 2018 at 12:05:56 UTC, aliak wrote:
Eg:
template aliasOf(T) {
enum aliasOf(alias a) = is(typeof(a) == T);
}
The use case for this is for std.meta.allSatisfy for variadic
args, i.e.
template T(values...) if (allSatisfy!(aliasOf!string, values) {
... }
But how do you
On Saturday, 10 March 2018 at 20:48:06 UTC, Nordlöw wrote:
If I have a function
bool f(Rs...)(Rs rs)
is it somehow possible to map and forward all its arguments
`rs` to another function
bool g(Rs...)(Rs rs);
through a call to some map-and-forward-like-function
`forwardMap` in somet
This works:
```
class S {
int n, m;
int sum() { return n + m; }
Inner!(sum) a;
class Inner(alias f){
auto get() {
return f();
}
}
}
```
This doesn't:
```
struct S {
int n, m;
int sum() { return n + m; }
Inner!(sum) a;
struct Inne
On Sunday, 11 March 2018 at 07:17:58 UTC, Mario wrote:
On Sunday, 11 March 2018 at 07:11:09 UTC, rikki cattermole
wrote:
On 11/03/2018 8:02 PM, Mario wrote:
On Sunday, 11 March 2018 at 06:59:32 UTC, rikki cattermole
wrote:
On 11/03/2018 7:55 PM, Mario wrote:
[...]
Are you aware that it is c
Eg:
template aliasOf(T) {
enum aliasOf(alias a) = is(typeof(a) == T);
}
The use case for this is for std.meta.allSatisfy for variadic
args, i.e.
template T(values...) if (allSatisfy!(aliasOf!string, values) {
... }
But how do you call that template otherwise?
I've tries:
* aliasOf!in
On Saturday, 10 March 2018 at 20:48:06 UTC, Nordlöw wrote:
If I have a function
bool f(Rs...)(Rs rs)
is it somehow possible to map and forward all its arguments
`rs` to another function
bool g(Rs...)(Rs rs);
through a call to some map-and-forward-like-function
`forwardMap` in somet
On Saturday, 10 March 2018 at 23:00:07 UTC, Jonathan M Davis
wrote:
The idea is that the type can provide its own version of the
function that is better optimized for it - e.g. it could
potentially provide a member function find that is more
efficient for it than std.algorithm.searching.find.
22 matches
Mail list logo