On 09.05.22 23:24, Ben Jones wrote:
enum x;
enum y = 5;
struct Wrap(alias T) {
static if(isType!T){
T value; //When t == x this doesn't work because `x` is opaque
and has no default initializer
}
}
[...]
x is a "type" as far as isType is concerned (which makes sense to m
On Tuesday, 10 May 2022 at 04:21:04 UTC, Ali Çehreli wrote:
On 5/9/22 20:38, rikki cattermole wrote:
> [...]
Yes! :)
Assuming the data is indeed validated in some way, the
following should be even faster. It validates the data after
the fact:
[...]
this is cool! thanks for your time and
On Tuesday, 10 May 2022 at 03:38:08 UTC, rikki cattermole wrote:
If I am understanding the problem correctly, this is a super
expensive method for doing something pretty simple. Even if it
is a bit more code, this won't require memory allocation which
in this case wouldn't be cheap (given how b
On 5/9/22 20:52, Ben Jones wrote:
> Using is(T) instead of isType!T also appears to be true for the
> un-instantiate-able enum. Was your point just that I could replace
> isType!T with is(T)?
I just found something that looked like a workaround. I don't know
whether it is by design or by accid
On 5/9/22 20:38, rikki cattermole wrote:
> this is a super expensive
> method for doing something pretty simple.
Yes! :)
Assuming the data is indeed validated in some way, the following should
be even faster. It validates the data after the fact:
import std.stdio;
import std.range;
import st
On Monday, 9 May 2022 at 21:58:59 UTC, Ali Çehreli wrote:
On 5/9/22 14:24, Ben Jones wrote:
> Is there a trait that can tell if you
> can initialize a variable of a certain type?
Not answering that question but the 'is' expression seems to
work in this case:
static if(is (T)) {
If I am understanding the problem correctly, this is a super expensive
method for doing something pretty simple. Even if it is a bit more code,
this won't require memory allocation which in this case wouldn't be
cheap (given how big DNA tends to be).
string s = "ACGTACGT";
uint[4] counts;
fo
s is the string, and print result as following:
s.array.sort!("athen how to transfer into
[['A',231],['C',247],['G',240],['T',209]]? tried map!, but can
only sortout key or value... tried array(), but result is not
sorted then...thanks in advance.
On Tuesday, 10 May 2022 at 01:00:24 UTC, frame wrote:
So `__traits(getOverloads)` returns also templated members and
`__traits(isTemplate)` can select those members. Unfortunately,
`Parameters!` does not work with the templated member. How can
I pass a symbol of T or A... to `Parameters!` as de
On Tuesday, 10 May 2022 at 01:07:37 UTC, Mike Parker wrote:
```d
import std.conv : to;
string s = to!string(pszUserString);
```
Thanks, it worked. At first, I tried `to!string` but it failed
because of this usage--
```d
this(LPCWSTR dtpStr) { this.dateString =
to!string(LPCWSTR)(dtpStr) ; }
On Tuesday, 10 May 2022 at 00:50:09 UTC, Vinod K Chandran wrote:
I want to convert this `pszUserString` to a string. How to do
it. Thanks in advance.
```d
import std.conv : to;
string s = to!string(pszUserString);
```
So `__traits(getOverloads)` returns also templated members and
`__traits(isTemplate)` can select those members. Unfortunately,
`Parameters!` does not work with the templated member. How can I
pass a symbol of T or A... to `Parameters!` as desired type
without instantiating the template?
```d
Hi all.
I want to convert an LPCWSTR to string.
I have a struct like this
```cpp
typedef struct tagNMDATETIMESTRINGW {
NMHDR nmhdr;
LPCWSTRpszUserString;
SYSTEMTIME st;
DWORD dwFlags;
} NMDATETIMESTRINGW, *LPNMDATETIMESTRINGW;
```
I want to convert this `pszUserString` to a s
On 5/9/22 14:24, Ben Jones wrote:
> Is there a trait that can tell if you
> can initialize a variable of a certain type?
Not answering that question but the 'is' expression seems to work in
this case:
static if(is (T)) {
T value;
}
https://dlang.org/spec/expression.html#Is
I have a struct template that takes an alias parameter and I'm
trying to distinguish between type parameters and enum values.
std.traits.isType works for this except for one edge case:
```
import std.traits;
import std.stdio;
struct S{}
enum x;
enum y = 5;
struct Wrap(alias T) {
static i
On Monday, 28 June 2021 at 16:25:20 UTC, vnr wrote:
On Monday, 28 June 2021 at 16:14:07 UTC, Andre Pany wrote:
On Monday, 28 June 2021 at 13:53:05 UTC, vnr wrote:
[...]
Hi,
Heroku is Cloud Foundry? If yes, you can make use of the
binary buildpack or deploying your app as container too.
Ki
On Friday, 6 May 2022 at 11:31:27 UTC, Alexander Zhirov wrote:
Does anyone have examples of such a configuration?
I managed to do it like this:
```js
{
"name": "app",
"authors": [
"Alexander Zhirov"
],
"description": "MyProgram",
"dflags": [
"-i"
],
17 matches
Mail list logo