On Sunday, 16 August 2020 at 18:13:07 UTC, Anonymouse wrote:
Just as a drive-by comment, the main stdio thing I came across
that I couldn't do from within @safe was stdout.flush(), which
I need to call manually for Cygwin terminals and some terminals
embedded in editors (vscode). If someone kno
On Tuesday, 18 August 2020 at 05:54:16 UTC, H. S. Teoh wrote:
Here's a working example:
Thank you, it works!
On Tue, Aug 18, 2020 at 05:34:58AM +, novice3 via Digitalmars-d-learn wrote:
[...]
> The problem is:
> if i use fmt.spec in overloaded toString(),
> when i get error "phobos/std/format.d(2243): Error: no property ip for
> type onlineapp.IpV4Address"
Here's a working example:
-
On Monday, 17 August 2020 at 14:43:27 UTC, H. S. Teoh wrote:
What you need is to create an overload of toString that takes a
FormatSpec parameter, so that you can decide what should be
output for which format spec. Something along these lines:
Sorry, i can't make it works.
I tried ti read for
The following code just sorts each row:
--
/+dub.sdl:
dependency "mir-algorithm" version="~>3.9.24"
+/
import mir.ndslice;
import mir.ndslice.sorting;
import mir.algorithm.iteration: each;
void main() {
// fuse, not sliced if you use an array of arrays for argument
auto a = [[1,
I want to sort a two-dimensional ndslice by its columns according
to some predefined predicate.
What I mean is _not_ sorting the contents of each column
individually, but instead to reorder the entire columns of the
matrix so that they are sorted according to some "greater than"
function.
H
On Monday, 17 August 2020 at 21:18:41 UTC, Per Nordlöw wrote:
I'm using
pragma(msg, __FILE__, "(", __LINE__, ",1): Debug: ", "A
useful debug message");
to print compile-time information formatted as standard
compiler diagnostics.
These are picked up by Emacs Flycheck and overlayed in t
I'm using
pragma(msg, __FILE__, "(", __LINE__, ",1): Debug: ", "A
useful debug message");
to print compile-time information formatted as standard compiler
diagnostics.
These are picked up by Emacs Flycheck and overlayed in the editor
and listen in the *Flycheck errors* buffer. Very con
On Thursday, 13 August 2020 at 09:54:06 UTC, Mr. Backup wrote:
On Wednesday, 12 August 2020 at 13:46:06 UTC, James Blachly
wrote:
Unfortunately the problem still occurs with Vibe.d 0.9.0
IMO **this is the single most important problem to fix** for
vibe.d -- if the most basic of examples (inde
On Mon, Aug 17, 2020 at 02:29:47PM +, novice3 via Digitalmars-d-learn wrote:
[...]
> ```
> struct IpV4Address
> {
> private uint ip;
> alias ip this;
>
> string toString()
> {
> import std.conv: to;
> return to!string((ip >>> 24) & 0xFF) ~ "." ~
>to!string((ip >>> 1
Hello.
I need subtype uint to store ipv4 address.
It should be like ordinary uint,
except conversion to string with %s format.
My try https://run.dlang.io/is/fwTc0H failed on last assert:
```
struct IpV4Address
{
private uint ip;
alias ip this;
string toString()
{
import std.conv:
On Monday, 17 August 2020 at 10:11:29 UTC, MoonlightSentinel
wrote:
On Monday, 17 August 2020 at 09:59:21 UTC, novice3 wrote:
On Monday, 17 August 2020 at 09:45:55 UTC, novice3 wrote:
access violation occur.
reduced code https://run.dlang.io/is/U58t9R
The wrapper parameters don't inherit th
On Monday, 17 August 2020 at 09:59:21 UTC, novice3 wrote:
On Monday, 17 August 2020 at 09:45:55 UTC, novice3 wrote:
access violation occur.
reduced code https://run.dlang.io/is/U58t9R
The wrapper parameters don't inherit the storage classes from
the wrapped function. Try using std.traits.P
On Monday, 17 August 2020 at 09:45:55 UTC, novice3 wrote:
access violation occur.
reduced code https://run.dlang.io/is/U58t9R
void test(out int x) { x = 42; }
void call (alias fn, Args ...)(Args args) { fn(args); }
void main(){
int a;
a = 111;
test(a);
assert(a == 42); // O
On Monday, 17 August 2020 at 08:55:49 UTC, Simen Kjærås wrote:
Take the function as an alias parameter and wrap the entire
call:
Simen, for some reasons, your code dont respect api arg with
"out" attribute.
For example, i have
```
extern (Windows)
DhcpEnumServers(
in DWORD
On Monday, 17 August 2020 at 08:55:49 UTC, Simen Kjærås wrote:
Take the function as an alias parameter and wrap the entire
call:
auto denforce(alias fn, string file = __FILE__, size_t line =
__LINE__, Args...)(Args args)
Thank you, Simen!
On Monday, 17 August 2020 at 08:07:32 UTC, novice3 wrote:
Hello.
I have wrapping Windows API functions, wich return 0 on success
and erroro code on failure.
I copy wenforce template as:
```
private T denforce(T, S)(T value, lazy S msg = null, string
file = __FILE__, size_t line = __LINE__)
{
Hello.
I have wrapping Windows API functions, wich return 0 on success
and erroro code on failure.
I copy wenforce template as:
```
private T denforce(T, S)(T value, lazy S msg = null, string file
= __FILE__, size_t line = __LINE__)
{
import core.sys.windows.winerror: NO_ERROR;
import std
18 matches
Mail list logo