On Saturday, 20 January 2018 at 19:09:28 UTC, Adam D. Ruppe wrote:
On Saturday, 20 January 2018 at 19:04:06 UTC, jsako wrote:
I want to be able to filter a range based on a variable known
at runtime. Something like this:
[code]
int id = getFilterID();
auto filteredRange = filter!(a => a.id
On Saturday, 20 January 2018 at 19:04:06 UTC, jsako wrote:
I want to be able to filter a range based on a variable known
at runtime. Something like this:
[code]
int id = getFilterID();
auto filteredRange = filter!(a => a.id ==
id)(rangeToBeFiltered);
[/code]
This doesn't seem to be
I want to be able to filter a range based on a variable known at
runtime. Something like this:
[code]
int id = getFilterID();
auto filteredRange = filter!(a => a.id == id)(rangeToBeFiltered);
[/code]
This doesn't seem to be possible, however as .filter only takes
unary predicates. I tried:
On Saturday, 20 January 2018 at 17:05:40 UTC, Simen Kjærås wrote:
On Saturday, 20 January 2018 at 14:31:59 UTC, Sobaya wrote:
How can I wrap function whose arguments contain both ref and
normal like 'func' ?
With normal 'Args', x is not increased because x is copied
when passed to opDispatch.
On Friday, January 19, 2018 23:39:08 rumbu via Digitalmars-d-learn wrote:
> Thank you Adam, just figured out myself the same solution, but I
> didn't expect to have a static constructor in main.d. I thought
> static constructors are meant to be used in imported modules.
> Thanks again.
There
On Saturday, 20 January 2018 at 04:54:47 UTC, Adam D. Ruppe wrote:
Same as above. The general pattern is:
C_Type[] name = new C_Type[](requested_size);
// pass as `name.ptr`. This becomes a C_Type*
Thanks, Adam. Perhaps something like this ought to make its way
into the "D for C Programmers"
On Saturday, 20 January 2018 at 14:31:59 UTC, Sobaya wrote:
How can I wrap function whose arguments contain both ref and
normal like 'func' ?
With normal 'Args', x is not increased because x is copied when
passed to opDispatch.
If I write 'ref Args' in opDispatch's argument, it fails
because
I'm using opDispatch for wrapping a function like below.
```
import std.stdio;
void func(ref int x, int y) {
x++;
}
struct B {
// wraps 'func'. I want to implement this function.
template opDispatch(string fn) {
void opDispatch(Args...)(Args args) {
On Thursday, 18 January 2018 at 03:50:15 UTC, arturg wrote:
On Wednesday, 17 January 2018 at 17:37:07 UTC, H. S. Teoh wrote:
On Wed, Jan 17, 2018 at 05:31:03PM +, Azi Hassan via
Digitalmars-d-learn wrote:
The D tour for structs uses a syntax similar to that of C++
in order to initialize a
On Saturday, 30 January 2016 at 03:13:59 UTC, Matt Elkins wrote:
std.typecons.Unique seems to require heap allocation, which
makes it a far cry from std::unique_ptr.
isn't unique_ptr typically for heap allocation?
eg:
10 matches
Mail list logo