I want to format an array using the %(...%) syntax. How can I
change the separator? I tried to use ? and add it as additional
parameter, but that doesn't seem to work on arrays:
import std;
void main()
{
writeln("This works:");
writefln("%,2?d", '_', 2000); // 20_00
auto vec = [100
On Monday, 27 January 2020 at 18:12:40 UTC, Steven Schveighoffer
wrote:
Before I show you what to do, let me explain what the above
actually does.
1. You constructed a buffer of characters. Good, this is the
first step.
2. You used encodeText to convert the data to ubyte. Note that
for char b
On 1/27/20 5:39 PM, Marcel wrote:
Hello!
If I declare a static variable inside a struct that contains a shared
field, is that new variable also shared? For example, say I have a
custom atomic wrapper type, like C++'s std::atomic, that contains
only one shared variable: Does it remain shared wh
On Monday, 27 January 2020 at 22:20:42 UTC, H. S. Teoh wrote:
On Mon, Jan 27, 2020 at 10:13:47PM +, Herbert via
Digitalmars-d-learn wrote:
On Monday, 27 January 2020 at 21:51:35 UTC, Adam D. Ruppe
wrote:
> On Monday, 27 January 2020 at 21:21:55 UTC, Herbert wrote:
> > My project does not al
Hello!
If I declare a static variable inside a struct that contains a
shared field, is that new variable also shared? For example, say
I have a custom atomic wrapper type, like C++'s std::atomic,
that contains only one shared variable: Does it remain shared
when I instantiate one or do I have
On Mon, Jan 27, 2020 at 10:13:47PM +, Herbert via Digitalmars-d-learn wrote:
> On Monday, 27 January 2020 at 21:51:35 UTC, Adam D. Ruppe wrote:
> > On Monday, 27 January 2020 at 21:21:55 UTC, Herbert wrote:
> > > My project does not allow dynamic memory. So I can't use
> > > delegates.
> >
> >
On Monday, 27 January 2020 at 21:51:35 UTC, Adam D. Ruppe wrote:
On Monday, 27 January 2020 at 21:21:55 UTC, Herbert wrote:
My project does not allow dynamic memory. So I can't use
delegates.
delegates do not require dynamic memory.
&obj.member doesn't allocate any new memory (it just points
On 1/27/20 1:15 PM, Herbert wrote:
On Monday, 27 January 2020 at 20:15:33 UTC, Steven Schveighoffer wrote:
On 1/27/20 3:06 PM, Herbert wrote:
How can I create a subrange type, for example ushort DiceValue {1 ...
6}?
D doesn't have a "Range" type like this. But you can use ranges of
different
On Mon, Jan 27, 2020 at 09:15:58PM +, Herbert via Digitalmars-d-learn wrote:
[...]
> How can I have a function parameter with this type (DiceValue)?
Just take an integer type and add a contract that enforces range. For
example:
auto myFunc(int diceValue)
in (diceValue
On Monday, 27 January 2020 at 21:21:55 UTC, Herbert wrote:
My project does not allow dynamic memory. So I can't use
delegates.
delegates do not require dynamic memory.
&obj.member doesn't allocate any new memory (it just points to
the existing object) yet yields a delegate.
My project does not allow dynamic memory. So I can't use
delegates.
How can I declare a class member function with a callback
function pointer?
On Monday, 27 January 2020 at 20:15:33 UTC, Steven Schveighoffer
wrote:
On 1/27/20 3:06 PM, Herbert wrote:
How can I create a subrange type, for example ushort DiceValue
{1 ... 6}?
D doesn't have a "Range" type like this. But you can use ranges
of different types by typing the literals. Note
On Monday, 27 January 2020 at 20:06:14 UTC, Herbert wrote:
How can I create a subrange type, for example ushort DiceValue
{1 .. 6}?
Probably the closest you can get is a struct with an invariant:
import std.traits: isOrderingComparable;
struct Subrange(T, T min, T max)
if (isOrderingCompa
On 1/27/20 3:06 PM, Herbert wrote:
How can I create a subrange type, for example ushort DiceValue {1 ... 6}?
D doesn't have a "Range" type like this. But you can use ranges of
different types by typing the literals. Note that D numeric ranges are
always exclusive at the upper end.
e.g.:
us
On 1/27/20 3:05 PM, Herbert wrote:
How can a class provide it's users with named constants, enums, types,
structs and not just member functions?
Just declare them inside the class. They then go inside the class
namespace, but are not strictly part of the class instance itself.
e.g.:
class C
How can I create a subrange type, for example ushort DiceValue {1
.. 6}?
How can a class provide it's users with named constants, enums,
types, structs and not just member functions?
On 1/27/20 1:12 PM, Steven Schveighoffer wrote:
void writeln(Pipe)(ref Pipe sink, string text)
{
enforce(sink.ensureElems(text.size) >= text.length); // make sure
there's enough buffer space to hold the text
sink[0 .. text.length] = text; // write to the buffer
sink.release(text.le
On 1/26/20 11:59 PM, Jesse Phillips wrote:
On Monday, 27 January 2020 at 01:50:00 UTC, Jesse Phillips wrote:
Just as I'm hitting send the part I'm missing clicked:
I needed to add the text encoding because my buffer is `char` but File
writes `ubyte`
```dlang
auto output() {
retur
On Saturday, 25 January 2020 at 21:33:09 UTC, JN wrote:
I assume it's working now?
Yup it works.
For future, learn to use RenderDoc:
https://renderdoc.org/
it allows you to debug your OpenGL application and see what
kind of data is sent by your app.
Wow that's what I need. Thanks for sh
On Monday, 27 January 2020 at 13:41:13 UTC, Ferhat Kurtulmuş
wrote:
On Monday, 27 January 2020 at 13:24:03 UTC, Marcone wrote:
On Monday, 27 January 2020 at 13:07:20 UTC, rumbu wrote:
[...]
Thank you very much! But I have this error when I try to
compile:
Error 42: Symbol Undefined _InitCo
On Monday, 27 January 2020 at 13:24:03 UTC, Marcone wrote:
On Monday, 27 January 2020 at 13:07:20 UTC, rumbu wrote:
[...]
Thank you very much! But I have this error when I try to
compile:
Error 42: Symbol Undefined _InitCommonControls@0
Error: linker exited with status 1
I am using Resedit
On Monday, 27 January 2020 at 13:07:20 UTC, rumbu wrote:
On Monday, 27 January 2020 at 11:34:47 UTC, Marcone wrote:
[...]
Translated (including errors & comments):
import core.sys.windows.windows;
import core.sys.windows.commctrl;
import std.stdio;
HINSTANCE hInst;
extern(Windows):
BOOL D
On Monday, 27 January 2020 at 11:34:47 UTC, Marcone wrote:
#include
#include
#include
#include "resource.h"
#include
HINSTANCE hInst;
BOOL CALLBACK DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam,
LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG:
{
}
return TRUE;
#include
#include
#include
#include "resource.h"
#include
HINSTANCE hInst;
BOOL CALLBACK DlgMain(HWND hwndDlg, UINT uMsg, WPARAM wParam,
LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG:
{
}
return TRUE;
case WM_CLOSE:
{
EndDialog(hwndDlg, 0);
25 matches
Mail list logo