So I have this immutable array with user defined structs but I
can not
make a copy from it.
See:
struct SwA {
string[] strings;
}
void main()
{
immutable(SwA)[] arr1;
SwA[] arr2 = arr1.dup;
}
Says:
Error: cannot implicitly convert element type immutable(SwA) to
mutable in
On Friday, 26 October 2012 at 16:32:29 UTC, Jonathan M Davis
wrote:
On Friday, October 26, 2012 15:55:34 simendsjo wrote:
So.. What do I need to implement for a struct to be a valid
built-in type?
All valid properties (min, max etc) and operators for that
type?
So, you want stuff like
On Saturday, October 27, 2012 11:58:57 simendsjo wrote:
The thing is that I often doesn't really care about the type,
only that it exposes certain properties.
Then create a template constraint (or eponymous template to use in a template
constraint) which tests for those properties. That's
On Saturday, 27 October 2012 at 10:07:20 UTC, Jonathan M Davis
wrote:
On Saturday, October 27, 2012 11:58:57 simendsjo wrote:
The thing is that I often doesn't really care about the type,
only that it exposes certain properties.
Then create a template constraint (or eponymous template to use
On Saturday, 27 October 2012 at 11:06:09 UTC, Matt wrote:
I'm having real trouble reading binary data from a file. I've
been trying to use the functions from std.stdio, but keep
running into problems. When I try;
byte b;
auto file = new File( some binary file );
file.readf( %d, b );
I get
I'm having real trouble reading binary data from a file. I've
been trying to use the functions from std.stdio, but keep running
into problems. When I try;
byte b;
auto file = new File( some binary file );
file.readf( %d, b );
I get Unexpected '€' when converting from type
LockingTextReader
hi,
could anyone please explain how an array of Handlers is defined?
void Handler(int, int);
struct WData {
POINTS mouse; // Current location of the mouse
Queue clicks[WM_MOUSELAST - WM_MOUSEFIRST + 1]; //
Array to hold the coordinates of the clicks
int
try:
Handler[] mouse_handlers = new [WM_MOUSELAST - WM_MOUSEFIRST
+ 1]
or if the size is statically known:
Handler[WM_MOUSELAST - WM_MOUSEFIRST + 1] handler;
On Saturday, October 27, 2012 12:34:28 simendsjo wrote:
So something like this then?
Whatever you need for what you're trying to do. If your example templates test
what you need tested, then they should work, though I confess that for
something like division, it seems to me to be overkill to
On Friday, 26 October 2012 at 19:57:14 UTC, Zhenya wrote:
On Thursday, 25 October 2012 at 15:05:05 UTC, Zhenya wrote:
Hi!
Tell me please,are any TypeInfo/typeid/classinfo manipulations
possible?
For example I need a struct that overload typeid, or something
like that?
Some time ago I tried
On Thursday, 25 October 2012 at 15:05:05 UTC, Zhenya wrote:
Hi!
Tell me please,are any TypeInfo/typeid/classinfo manipulations
possible?
For example I need a struct that overload typeid, or something
like that?
It is impossible to overload typeid typeinfo.
Some time ago I tried to write
On Friday, 26 October 2012 at 19:57:14 UTC, Zhenya wrote:
On Thursday, 25 October 2012 at 15:05:05 UTC, Zhenya wrote:
Hi!
Tell me please,are any TypeInfo/typeid/classinfo manipulations
possible?
For example I need a struct that overload typeid, or something
like that?
Some time ago I tried
What do you mean: to parametrize class by Typeinfo?
class A { }
A!TypeInfo var;
If you mean this, than how it can help?
It would be well if I could create object that inherits class
with this typeinfo.
I have double dispatcher:
template Dispatcher(R)
{
R execute(Left,Right)(R delegate(Left,Right) f,Object
left,Object right)
{
return f(cast(Left)left,cast(Right)right);
}
struct Dispatcher
{
private R
On Saturday, 27 October 2012 at 11:59:16 UTC, Tobias Pankrath
wrote:
try:
Handler[] mouse_handlers = new [WM_MOUSELAST - WM_MOUSEFIRST
+ 1]
or if the size is statically known:
Handler[WM_MOUSELAST - WM_MOUSEFIRST + 1] handler;
Thank you for your help.
after doing what you propose, i get the
On Saturday, 27 October 2012 at 14:05:20 UTC, hr wrote:
On Saturday, 27 October 2012 at 11:59:16 UTC, Tobias Pankrath
wrote:
try:
Handler[] mouse_handlers = new [WM_MOUSELAST - WM_MOUSEFIRST
+ 1]
or if the size is statically known:
Handler[WM_MOUSELAST - WM_MOUSEFIRST + 1] handler;
Thank
On 10/27/2012 02:30 AM, Tobias Pankrath wrote:
So I have this immutable array with user defined structs but I can not
make a copy from it.
See:
struct SwA {
string[] strings;
}
void main()
{
immutable(SwA)[] arr1;
SwA[] arr2 = arr1.dup;
}
Says:
Error: cannot implicitly convert element type
I don't mean to be splitting hairs here, well maybe I do, but
D clearly makes the string type to be immutable(char)[]. That's
fine, but the std.string is all about char[] or mutable character
arrays.
So now, whenever I see a reference to the string, I have to ask
myself: do they mean the
On Sat, Oct 27, 2012 at 06:53:56PM +0200, TheManWithNoName wrote:
I don't mean to be splitting hairs here, well maybe I do, but
D clearly makes the string type to be immutable(char)[]. That's
fine, but the std.string is all about char[] or mutable character
arrays.
Huh?
I think you're
In any case, though, separately initializing every member of an
array is
silly. That's what a loop is for. That, or a memcpy from an
immutable
copy of .init.
I think that the reasoning behind DMD's implementation is that
for small structs, writing out the instructions is more efficient
On Saturday, 27 October 2012 at 23:07:19 UTC, BLM768 wrote:
In any case, though, separately initializing every member of
an array is
silly. That's what a loop is for. That, or a memcpy from an
immutable
copy of .init.
I think that the reasoning behind DMD's implementation is that
for
21 matches
Mail list logo