On 2012-10-04 16:09, Jesse Phillips wrote:
IIRC, inout must be applied to the return type too, and it only works in
templates.
What? The whole point of inout is to NOT have to use templates since
the compiler will generate the same code anyway.
On 2012-10-04 16:18, Ali Çehreli wrote:
inout is like a template on 'mutable', const, and immutable; but it need
not be applied to templates. Here is a simple example that transfers the
mutability to the return type:
I do think I understand how inout works, or at least I thought. I
don't
The example below fails to compile:
inout(int) foo (inout int a)
{
writeln(a);
return a;
}
void main ()
{
foo(1);
}
If I remove the call to writeln it compiles.
DMD 2.060 on Mac OS X, error message:
conv.d(3572): Error: template instance Unqual!(__T4ImplTNgiZ)
On 2012-10-04 21:30, timotheecour wrote:
Even if I don't need to redefine:
As I was explaining in the first post, my original problem was that
calling the existing (non-templated, non-modified) extern(C)
std_stdio_static_this() seems to have no effect: a call to writeln(0)
will cause a runtime
Hi!
I am make a yet another attempt to create an interface to
PostgreSQL from the D: https://github.com/denizzzka/dpq2
I can not understand how do I compile it into a library and
create .di headers file. Currently, make debug uses dmd -lib
and creates libpq.di file, but its file contains
Although this likely isn't the most efficient way to do this,
it's cropped up and here's what I have so far. The idea is to
drop all the unwanted pathname and only leave the filename (I'm
sure there's a function there already, just not finding it off
hand).
Why is this failing?
[quote]
Mmmm glancing at the notes again, maybe I misread it and it only
skips if the beginning equals, rather than if it contains...
Kinda annoying since it sounds like what I wanted would work...
(sorry for my English)
Hi!
I am make a yet another attempt to create an interface to
PostgreSQL from the D: https://github.com/denizzzka/dpq2
I can not understand how do a compile it into a library and
create .di headers file. Currently, make debug uses dmd -lib
and creates libpq.di file, but
I tried to add:
export { /* module code except imports*/}
but nothing has changed.
Although, the only case, where this would be
a problem is with a range of type T, where:
1) It's impossible to provide random access to T
2) T can't return a reference from its 'front' property
3) T is a finite range (not infinite)
4) 'front' property may return the same value at different
solved!
problem was in -Hf compiler switch
On 10/05/2012 01:08 AM, Tommi wrote:
I can write the following in C++ to iterate through all 2-subsets of a
forward-range in that specific order:
#include iterator
#include boost/range/concepts.hpp
template typename R
void fun(const R r)
{
BOOST_CONCEPT_ASSERT(( ForwardRangeConceptR ));
On Friday, 5 October 2012 at 09:37:51 UTC, Ali Çehreli wrote:
This brings up a question: Should all range types implement
opEquals() for range equality as opposed to identity
equality of the underlying range (i.e. Take.source in this
case).
But even if the range concept was altered so that
import std.range;
int[] numbers = [1, 3, 5, 7, 9, 11];
auto rangeObject = inputRangeObject(numbers);
auto inputRange = cast(InputRange!(int[]))rangeObject;
why does 'inputRange' equal null?
The short answer is yes, slices satisfy the requirements of InputRange.
(And all the other ranges as well.)
There is a distinction between an array and a slice and what you hvae in
your code are slices anyway. Dynamic arrays are owned by the runtime.
What we get is a slice to the elements of
ref2401 wrote:
import std.range;
int[] numbers = [1, 3, 5, 7, 9, 11];
auto rangeObject = inputRangeObject(numbers);
auto inputRange = cast(InputRange!(int[]))rangeObject;
why does 'inputRange' equal null?
Because you specified int[] element type and cast operator returns null
when objects
On 10/04/2012 11:30 PM, Jacob Carlborg wrote:
On 2012-10-04 16:18, Ali Çehreli wrote:
inout is like a template on 'mutable', const, and immutable; but it need
not be applied to templates. Here is a simple example that transfers the
mutability to the return type:
I do think I understand how
Are there any known workarounds for forward reference bugs?
I see 80 bugs is filed, but I don't want to read all of them to
find any workarounds. I cannot find anything on the wiki
regarding this.
So.. Any good ideas how to get around this?
On Thu, 04 Oct 2012 09:49:48 -0400, Jacob Carlborg d...@me.com wrote:
void foo (inout int[] arr)
{
auto a = { auto b = arr[0]; };
}
void main ()
{
auto a = [3, 4, 5];
foo(a);
}
Compiling the above code with DMD 2.060 results in the following error
message:
Error: variable
On Thursday, 4 October 2012 at 20:06:20 UTC, anonymous wrote:
On Thursday, 4 October 2012 at 19:49:35 UTC, Paul wrote:
This is my test code:
import std.stdio;
import std.conv;
import std.string;
void main(string args[])
{
writeln(to!float(args[1])==to!float(args[2]));
}
When I enter 1E-7 and
On Friday, 5 October 2012 at 13:39:56 UTC, ref2401 wrote:
import std.range;
int[] numbers = [1, 3, 5, 7, 9, 11];
auto rangeObject = inputRangeObject(numbers);
auto inputRange = cast(InputRange!(int[]))rangeObject;
why does 'inputRange' equal null?
On another note to what others said. An
On Friday, 5 October 2012 at 13:39:56 UTC, ref2401 wrote:
import std.range;
int[] numbers = [1, 3, 5, 7, 9, 11];
auto rangeObject = inputRangeObject(numbers);
auto inputRange = cast(InputRange!(int[]))rangeObject;
why does 'inputRange' equal null?
Suggested reading:
What does 'd' in dchar and dstring stand for?
On 10/05/2012 10:28 PM, Tommi wrote:
What does 'd' in dchar and dstring stand for?
This is what I have been assuming:
wchar: wide char
dchar: double wide char
Ali
24 matches
Mail list logo