I know that sort accepts Range( I am correct right ? ), so,
Array!uint arr;
//inserts element to arr
sort( arr.Range );
don't work, it says cannot pass RangeT!(Array!uint) as function
argument
well, not really, it just cannot auto deduce, the problem is, I
don't know what to put in, I know that I can put in
SwapStrategy.stable for the first one, but what about the Range,
I don't know what to put in
E.g
int[] i = [ 1, 2 ];
i = i.remove( 1 );//able to automagically deduce
char[] c =
On Wednesday, 6 June 2018 at 14:46:56 UTC, ag0aep6g wrote:
On 06/06/2018 04:20 PM, Flaze07 wrote:
hmm, and sorry for asking more, what about removing an element
from it ? I found no remove operation that can remove from the
middle ( removeAny and removeBack both removes the latest
element,
On Tuesday, 12 June 2018 at 14:08:25 UTC, Steven Schveighoffer
wrote:
On 6/12/18 2:33 AM, Flaze07 wrote:
well, not really, it just cannot auto deduce, the problem is,
I don't know what to put in, I know that I can put in
SwapStrategy.stable for the first one, but what about the
Range, I don't
On Wednesday, 6 June 2018 at 14:06:54 UTC, rikki cattermole wrote:
On 07/06/2018 1:58 AM, Flaze07 wrote:
On Wednesday, 6 June 2018 at 13:46:41 UTC, Adam D. Ruppe wrote:
On Wednesday, 6 June 2018 at 13:44:09 UTC, Flaze07 wrote:
sort( arr.Range );
don't work, it says cannot pass
On Wednesday, 6 June 2018 at 13:46:41 UTC, Adam D. Ruppe wrote:
On Wednesday, 6 June 2018 at 13:44:09 UTC, Flaze07 wrote:
sort( arr.Range );
don't work, it says cannot pass RangeT!(Array!uint) as
function argument
Range is the type, you want the value
I think you can do
sort(arr[])
maybe
On Wednesday, 6 June 2018 at 14:24:15 UTC, rikki cattermole wrote:
On 07/06/2018 2:20 AM, Flaze07 wrote:
On Wednesday, 6 June 2018 at 14:06:54 UTC, rikki cattermole
wrote:
On 07/06/2018 1:58 AM, Flaze07 wrote:
[...]
Yes.
hmm, and sorry for asking more, what about removing an element
from
On Wednesday, 6 June 2018 at 14:29:28 UTC, rikki cattermole wrote:
On 07/06/2018 2:27 AM, Flaze07 wrote:
On Wednesday, 6 June 2018 at 14:24:15 UTC, rikki cattermole
wrote:
On 07/06/2018 2:20 AM, Flaze07 wrote:
On Wednesday, 6 June 2018 at 14:06:54 UTC, rikki cattermole
wrote:
[...]
hmm,
recently, I visited the glossary and saw that functor exist in
D...I know that functor exist C++ as a way to easily allow higher
order function, but since D already has function and delegates,
is there a point to functor ?
On Thursday, 21 June 2018 at 03:04:46 UTC, Computermatronic wrote:
On Thursday, 21 June 2018 at 02:44:12 UTC, Flaze07 wrote:
when I do
Tuple!(uint, "first", uint, "second")[string] what; //I tried
aliasing the tuple as well
what["something"].first = 20;
I get range error
but when I do
when I do
Tuple!(uint, "first", uint, "second")[string] what; //I tried
aliasing the tuple as well
what["something"].first = 20;
I get range error
but when I do
uint[string] what2;
what2 = 20;
I get none of those range error, so...how do I use tuple as value
type for associative array ?
e.g A is a class that emits output during destruction
{
auto a = scoped!A();
}
how do I contain it in a container, in the Array struct ?
{
auto a = scoped!A();
Array!( typeof( a ) ) arr;
foreach( i ; 0..3 ) {
arr.insertBack( scoped!A );
}
}
is that how you do it ?
On Tuesday, 3 July 2018 at 07:03:43 UTC, vit wrote:
On Tuesday, 3 July 2018 at 02:13:21 UTC, Flaze07 wrote:
e.g A is a class that emits output during destruction
{
auto a = scoped!A();
}
how do I contain it in a container, in the Array struct ?
{
auto a = scoped!A();
Array!(
On Tuesday, 3 July 2018 at 10:00:00 UTC, Mike Parker wrote:
The only way you're going to be leaking resources is if the app
is long running and the resource objects are never collected.
I'd be more concerned about the nondeterministic nature of the
destructor calls, particularly what happens
On Tuesday, 3 July 2018 at 14:32:01 UTC, Mike Parker wrote:
Resources allocated for the process will be released on exit.
I see...but it is dependant on the OS right ? because I have seen
other stuff relating to malloc as well, there are some out there
that said that there is no need to
I keep having the same problem with building DSFMLC
https://ibb.co/edRStK
On Sunday, 19 August 2018 at 08:57:05 UTC, Flaze07 wrote:
I keep having the same problem with building DSFMLC
https://ibb.co/edRStK
for anyone having the same problem, I found the solution in
another thread. You have to use MinGW32 bit version if you use
mingw, as for visual C++, I think
On Sunday, 15 July 2018 at 01:20:25 UTC, evilrat wrote:
...
"lflags": [ "/SUBSYSTEM:windows" ],
...
didn't know that, thank you
On Saturday, 14 July 2018 at 09:39:21 UTC, rikki cattermole wrote:
If you're using dub, throw them into lflags and remove the -L.
https://forum.dlang.org/post/gmcsxgfsfnwllploo...@forum.dlang.org
hmm, for some unknown reason it says that it is unable to find
SUBSYSTEM:windows.lib
how do you compile a D programs without a console window ? I
found this link
https://wiki.dlang.org/D_for_Win32 I know that you need .def
file, but how do you link to .def ?
I have a dub project, and I put the importPath to the path of the
file I want to import and the source file to the source folder,
and it appears that I have succeeded at importing the module, but
there's one problem, it appears like I need to define some sort
of thing, because the error says "
On Wednesday, 4 July 2018 at 16:02:25 UTC, Jonathan M Davis wrote:
-dip1000 fully implements scope so that it verifies that no
reference escapes, but it's not ready yet, let alone the
default behavior.
- Jonathan M Davis
I read the proposal about -dip1000 ( not all, some ) and there is
On Thursday, 5 July 2018 at 08:55:13 UTC, Timoses wrote:
Depending on your use case I see these options:
- If you have a library that defines the symbols that you are
using in the imported files you could use the dub `libs` setting
- Otherwise, if you're just using the other folder to separate
I have been trying to link self made .lib, and have tried to use
it several times, I failed..
so, here I have a file in this path :
Z:\programming\D\usefulFiles\experiment\source\output.d
it has
module output;
class Output {
public:
static void write( string msg ) {
import
On Friday, 6 July 2018 at 21:13:37 UTC, Timoses wrote:
Shouldn't this be 'import output'?
nah, because I didn't import source directly, I import experiment
so in order to use it, I do source/output.d, which when importing
module means, source.output
and this '...\\experiment\\source\\'? (I'm
On Saturday, 7 July 2018 at 08:09:51 UTC, vino.B wrote:
Hi All,
Request you help, on the below code
import std.stdio: writeln;
void process(T ...)(string ID, T args) {
if (ID == "I1") { writeln(args.length, "\t", args[0]); }
else if (ID == "I2") { writeln(args.length, "\t", args[1]);}
}
I want to force the variadic templates's type to be of certain
types, I thought doing this would work
auto sum( A... )( A a ) if( isIntegral!( typeid( a[ 0 ] ) ) )
{
int temp;
foreach( t ; a )
{
temp += t;
}
return temp;
}
but it gives out error
( note : I want all
On Sunday, 8 July 2018 at 00:46:13 UTC, Flaze07 wrote:
I want to force the variadic templates's type to be of certain
types, I thought doing this would work
auto sum( A... )( A a ) if( isIntegral!( typeid( a[ 0 ] ) ) )
{
int temp;
foreach( t ; a )
{
temp += t;
}
On Sunday, 8 July 2018 at 02:10:12 UTC, Simen Kjærås wrote:
Also, you should probably use CommonType!A for the type of
temp, since an int can't hold all the possible values of a long
or ulong (or even uint), and you'll thus get unexpected results
with large numbers.
--
Simen
I see, thanks,
On Monday, 9 July 2018 at 09:18:50 UTC, Flaze07 wrote:
I am using DSFML
module game;
[...]
oh, and I forgot, I had
Game myGame;
static this()
{
myGame = new Game;
}
below the Game class
I am using DSFML
module game;
import core.time;
import std.stdio: writeln;
import dsfml.graphics;
import dsfgui.button;
import apple;
import snake;
class Game
{
private:
enum State { menu, playing }
State state;
Font font;
Button playBtn;
Snake snake;
Apple apple;
On Monday, 9 July 2018 at 09:38:30 UTC, ag0aep6g wrote:
The `win` you're creating in `init` is a function-local
variable. It ceases to exist when `init` returns. It's not
`this.win`.
In `run`, you're accessing `this.win`. It's still null because
you never assigned anything there.
So change
On Tuesday, 3 July 2018 at 15:06:28 UTC, Mike Parker wrote:
..
That said, the GC in D runs when main exits anyway, so the
destructor in your example will be called. That's why I warned
earlier about it being nondeterministic. For example, if you
have a Texture instance that depends on the
On Friday, 22 June 2018 at 20:20:56 UTC, Steven Schveighoffer
wrote:
On 6/22/18 2:25 PM, Ali Çehreli wrote:
On 06/22/2018 08:17 AM, Steven Schveighoffer wrote:
> reason to use functors
I wonder whether they are more efficient because a functor
would carry just the state that it needs. Also,
On Thursday, 28 June 2018 at 08:52:33 UTC, Simen Kjærås wrote:
On Thursday, 28 June 2018 at 08:36:54 UTC, Flaze07 wrote:
is there some sort of ways to turn range into tuple ? ( an
array preferably )
e.g
uint[] arr = [ 10, 20, 30 ];
auto tup = rangeToTup( arr );
assert( tup[ 0 ] == 10 );
On Thursday, 28 June 2018 at 09:47:07 UTC, Jonathan M Davis wrote:
On Thursday, June 28, 2018 09:26:10 Flaze07 via
Digitalmars-d-learn wrote:
On Thursday, 28 June 2018 at 08:52:33 UTC, Simen Kjærås wrote:
> [...]
what about during runtime ?
Ranges in general have an arbitrary len
On Thursday, 28 June 2018 at 09:42:54 UTC, Flaze07 wrote:
On Thursday, 28 June 2018 at 09:38:36 UTC, Stefan Koch wrote:
On Thursday, 28 June 2018 at 09:26:10 UTC, Flaze07 wrote:
On Thursday, 28 June 2018 at 08:52:33 UTC, Simen Kjærås wrote:
On Thursday, 28 June 2018 at 08:36:54 UTC, Flaze07
On Thursday, 28 June 2018 at 09:38:36 UTC, Stefan Koch wrote:
On Thursday, 28 June 2018 at 09:26:10 UTC, Flaze07 wrote:
On Thursday, 28 June 2018 at 08:52:33 UTC, Simen Kjærås wrote:
On Thursday, 28 June 2018 at 08:36:54 UTC, Flaze07 wrote:
is there some sort of ways to turn range into tuple ?
is there some sort of ways to turn range into tuple ? ( an array
preferably )
e.g
uint[] arr = [ 10, 20, 30 ];
auto tup = rangeToTup( arr );
assert( tup[ 0 ] == 10 );
assert( tup[ 1 ] == 20 );
assert( tup[ 2 ] == 30 );
39 matches
Mail list logo