try:
auto names1 = names.map!( a => replace(a, "_"," "));
...not sure how to do it in-place though.
Joel wrote:
> auto names =
> "Alef Bet Gimel Dalet He Vav Zayen Het Tet Yod Final_Kaf "
> "Kaf Lamed Final_Mem Mem Final_Nun Nun Samekh Ayin Final_Pe "
> "Pe Final_Tsadi Tsadi Qof Resh Shin Tav"
try replacing:
final void output(T)(string text, T params...) const {
with
final void output(T...)(string text, T params) const {
Andre Polykanine via Digitalmars-d-learn wrote:
> Hi everyone,
> It's me again.
> Now I'm struggling with the `output` member function which should
> o
thanks for the reply...
the method you described is suitable for appending to an array, but I'm
using the singly-linked-list container.
I've extended the test, and I'm pretty sure it's a bug...
--ted
Nicholas Wilson wrote:
> On Thursday, 13 August 2015 at 08:40:13 UTC, ted wrote:
>>
>> have
have upgraded from 2.066.1 to 2.068.0, and have a change in behaviour:
import std.container: SList;
void main()
{
SList!int tmp;
tmp.insertAfter( tmp[], 3 );
}
used to work happily with dmd2.066.1, causes assert
(core.exception.AssertError@std/container/slist.d(57): Assertion failure)
bearophile wrote:
> ted:
>
>> ... where you say 'More DRY' above, are you referring to
>
> I was referring to both, but mostly to the typeof. It's more DRY
> (http://en.wikipedia.org/wiki/Don%27t_repeat_yourself ). You are
> stating only once the type of the return variable. This is less
> bug-p
bearophile wrote:
> ted:
>
>> Could someone enlighten me ?
>
> This works:
>
>
> import std.range: ElementType, isInputRange;
>
> ElementType!R testFunc(R, T)(R range, T foo)
> if (is(ElementType!R == T)) {
> static assert(isInputRange!R);
> typeof(return) retVal = foo ^^ 2; // More D
Ali Çehreli wrote:
> On 02/10/2015 12:31 AM, ted wrote:
>
> > ElementType!R testFunc(R)( R range, ElementType!R foo) //
compiles
> > with double foo
>
> If think it is a little too much to ask from the template system of D. A
> proper way of doing the same thing is to use a template const
Hi!
I get the following compile error (linux, dmd2.066.1):
test.d(13): Error: template test.testFunc cannot deduce function from
argument types !()(double[], double), candidates are:
test.d(3):test.testFunc(R)(R range, ElementType!R foo)
For the following test file:
import std.range: El
Darrell wrote:
> Seems when creating your own ranges they can't be a class.
> Must be a struct or Segmentation fault (core dumped) will follow.
>
> This works as long as Test is a struct.
>
> struct Test
> {
>@property int front()
>{
> return 2;
>}
>
>void popFront()
>{
Ali Çehreli wrote:
> On 01/02/2015 10:10 PM, ted wrote:
>
> > I'm now taking the view that const is there for the compiler to
> > optimise code on the basis that nothing can alter it once set (and can
> > only be set on initialisation).
>
> Of course, that is true for const values, not for co
ketmar via Digitalmars-d-learn wrote:
> On Sat, 03 Jan 2015 15:56:58 +1030
> ted via Digitalmars-d-learn wrote:
>
>> Ironically, I'm trying to use const in an effort to understand it...but
>> there seems to be an unusual amount of pain until I grok it.
> just r
ketmar via Digitalmars-d-learn wrote:
> On Sat, 03 Jan 2015 14:45:24 +1030
> ted via Digitalmars-d-learn wrote:
>
>> Well, I just cleared up some of my misunderstanding.
>>
>> I did not realise the mA (within struct Test) would be a _copy_ of arg,
>> not a refe
Well, I just cleared up some of my misunderstanding.
I did not realise the mA (within struct Test) would be a _copy_ of arg, not
a reference (pointer) to arg.
So the more correct code snippet would be:
struct A
{
int someInt;
}
struct Test
{
@property { const(A) getA() { return *mA;
hanks !
ketmar via Digitalmars-d-learn wrote:
> On Sat, 03 Jan 2015 13:25:31 +1030
> ted via Digitalmars-d-learn wrote:
>
>>
>> I get the following error from the code below: (dmd2.066.1, linux)
>> test.d(26): Error: cannot modify struct myTest1 Test with immuta
I get the following error from the code below: (dmd2.066.1, linux)
test.d(26): Error: cannot modify struct myTest1 Test with immutable members
Is this expected?
If so, how can I achieve this result - being able to set (a new) initial value
of myTest1 from within an nested function ?
thanks !
t
15 matches
Mail list logo