On Sunday, 14 January 2018 at 03:49:05 UTC, Jonathan M Davis
wrote:
I get the result "1000" from byte[] byteData =[0,0,0,8];
Thank you very much.
Good to hear.
On a side note, I would point out that you almost certainly
want to be using ubyte and not byte. byte is signed, whereas
ubyte i
On Sunday, 14 January 2018 at 02:24:52 UTC, Adam D. Ruppe wrote:
On Sunday, 14 January 2018 at 02:14:50 UTC, Jonathan M Davis
wrote:
If you're using template constraints rather than template
specializations, then you can't have any unconstrained
templates.
Not true: see the tip of the week he
On Sunday, 14 January 2018 at 01:38:17 UTC, Nordlöw wrote:
My current proposal for a solution is to make `byElement` a
free unary function
byElement(auto ref X x)
which statically checks via
static if (__traits(isRef, x))
whether the `X`-instance is passed as either an
- l-value, wh
vartmpl.d
```
import std.stdio : writeln;
import decimal : decimal32;
template F(T) {
immutable T c = 3;
}
void foo (T) ()
{
immutable T t = 1;
}
void main ()
{
// immutable decimal32 i = 1; // Error: none of the overloads
of '__ctor' are
callable using a immutable object
// foo!dec
So is this a bug, or am I misunderstanding something?
I didn't find how using traits I could get a class member type? I
need to test if give class member is not immutable, I find
isMutable but not how get a type from give class member to pass
to it.
On Sunday, 14 January 2018 at 16:23:18 UTC, kdevel wrote:
Why does this compile while both of the commented lines give a
compile error.
The code boils down to this:
struct decimal32
{
this(int x) {}
}
immutable decimal32 c = 3; /* works */
void main ()
{
immutable decimal32 i = 1
On Sunday, 14 January 2018 at 18:18:50 UTC, Marc wrote:
I didn't find how using traits I could get a class member type?
I need to test if give class member is not immutable, I find
isMutable but not how get a type from give class member to pass
to it.
for clarify, I want all this at compile t
On Sunday, 14 January 2018 at 19:08:44 UTC, Marc wrote:
On Sunday, 14 January 2018 at 18:18:50 UTC, Marc wrote:
I didn't find how using traits I could get a class member
type? I need to test if give class member is not immutable, I
find isMutable but not how get a type from give class member
t
give a list, how can I select only the elements of a range
according to a condition give by a lamba function?
something like this:
auto l = myList.select(e => e.id < 300);
it would return a range. Similar to C#'s select:
https://msdn.microsoft.com/en-us/library/bb548891(v=vs.110).aspx
15.01.2018 00:21, Marc пишет:
give a list, how can I select only the elements of a range according to
a condition give by a lamba function?
something like this:
auto l = myList.select(e => e.id < 300);
it would return a range. Similar to C#'s select:
https://msdn.microsoft.com/en-us/librar
On Sunday, 14 January 2018 at 21:21:52 UTC, Marc wrote:
give a list, how can I select only the elements of a range
according to a condition give by a lamba function?
something like this:
auto l = myList.select(e => e.id < 300);
it would return a range. Similar to C#'s select:
https://msdn.
On Sunday, 14 January 2018 at 14:04:46 UTC, kinke wrote:
That sounds reasonable. For something like `foreach (e;
makeRange().wrapRangeByRef())`, referencing the makeRange()
struct rvalue by pointer in the wrapped range won't work, as
the underlying range lifetime ends with the foreach range
ex
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)
On Sunday, 14 January 2018 at 21:59:26 UTC, Seb wrote:
On Sunday, 14 January 2018 at 21:21:52 UTC, Marc wrote:
give a list, how can I select only the elements of a range
according to a condition give by a lamba function?
something like this:
auto l = myList.select(e => e.id < 300);
it woul
On Sunday, 14 January 2018 at 21:38:39 UTC, drug wrote:
15.01.2018 00:21, Marc пишет:
give a list, how can I select only the elements of a range
according to a condition give by a lamba function?
something like this:
auto l = myList.select(e => e.id < 300);
it would return a range. Similar
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 lval/rval
On 15/01/2018 2:05 AM, Chris P wrote:
Hello,
I'm extremely new to D and have a quick question regarding common
practice when using strings. Is usage of one type over the others
encouraged? When using 'string' it appears there is a length mismatch
between the string length and the char array i
Hello,
I'm extremely new to D and have a quick question regarding common
practice when using strings. Is usage of one type over the others
encouraged? When using 'string' it appears there is a length
mismatch between the string length and the char array if large
Unicode characters are used. S
On Monday, 15 January 2018 at 02:05:32 UTC, Chris P wrote:
Hello,
I'm extremely new to D and have a quick question regarding
common practice when using strings. Is usage of one type over
the others encouraged? When using 'string' it appears there is
a length mismatch between the string length
On Monday, 15 January 2018 at 02:15:55 UTC, Nicholas Wilson wrote:
On Monday, 15 January 2018 at 02:05:32 UTC, Chris P wrote:
[...]
string == immutable( char)[], char == utf8
wstring == immutable(wchar)[], char == utf16
dstring == immutable(dchar)[], char == utf32
Unless you are dealing with
On Saturday, 13 January 2018 at 17:58:14 UTC, Joe wrote:
On Saturday, 13 January 2018 at 10:10:41 UTC, Jacob Carlborg
wrote:
There's a native D library, ddb [1], for connecting to
Postgres. Then you don't have to worry about null-terminated
strings.
There are several D libraries that I would
On Monday, January 15, 2018 02:22:09 Chris P via Digitalmars-d-learn wrote:
> On Monday, 15 January 2018 at 02:15:55 UTC, Nicholas Wilson wrote:
> > On Monday, 15 January 2018 at 02:05:32 UTC, Chris P wrote:
> >> [...]
> >>
> > string == immutable( char)[], char == utf8
> >
> > wstring == immutabl
let's assume I have
class C {
static string foo() { writeln("got called!"); // }
}
then I want to cache foo at some point:
import std.algorithm;
auto v = cache(c.foo);
I call do:
for(int i = 0; i <10; i++) {
writeln(v);
}
then it'll print "got called" only once, which is what I
On Monday, 15 January 2018 at 02:09:25 UTC, rikki cattermole
wrote:
Unicode has three main variants, UTF-8, UTF-16 and UTF-32.
The size of a code point is 1, 2 or 4 bytes.
I think to be technically correct, 1 (UTF-8), 2 (UTF-16) or 4
(UTF-32) bytes are referred to as "code units" and the si
On Monday, 15 January 2018 at 02:54:16 UTC, Marc wrote:
let's assume I have
class C {
static string foo() { writeln("got called!"); // }
}
then I want to cache foo at some point:
import std.algorithm;
auto v = cache(c.foo);
That doesn't do what I think you think it does.
http://dpl
On Saturday, 13 January 2018 at 06:18:43 UTC, Ali Çehreli wrote:
On 01/12/2018 06:50 PM, Venkat wrote:
> Sorry about all these posts. Wish there were an edit button.
That's ok. :) These are actually newsgroups (see NNTP
protocol). Newsgroups don't have any edit functionality. The
"forum" is ju
On Monday, January 15, 2018 03:14:02 Tony via Digitalmars-d-learn wrote:
> On Monday, 15 January 2018 at 02:09:25 UTC, rikki cattermole
>
> wrote:
> > Unicode has three main variants, UTF-8, UTF-16 and UTF-32.
> > The size of a code point is 1, 2 or 4 bytes.
>
> I think to be technically correct, 1
On Monday, 15 January 2018 at 02:05:32 UTC, Chris P wrote:
Is usage of one type over the others encouraged?
I would use string (UTF-8) throughout the program, but there
seems to be no style guideline for this. Keep in mind two gotchas:
D's foreach and D's ranges will autodecode and silently
On Sunday, 14 January 2018 at 22:07:22 UTC, Marc wrote:
thanks, can i use it at compile time as well?
enum isMutableString(string field) =
is(typeof(__traits(getMember, >C, field)) == string);
static foreach(field; [FieldNameTuple!C].filter!(f =>
isMutableString!(f))) {
30 matches
Mail list logo