Hello, I want to remove a car form a string.

hence i used the remove function from std.algorithm, and i had this :

string stripPar(string S)
{
        while(S[0] == '(' && S[S.length-1] == ')')
        {
        
             S = S.remove(0);
             S = S.remove(S.length-1);
        }

        return S;
}

(taking help from this: http://www.digitalmars.com/d/archives/digitalmars/D/learn/std.algorithm.remove_strange_behavior_removing_items_for_the_dynamic_35713.html)
I was having this error:

/home/apua/Software/dmd/dmd/src/phobos/std/algorithm.d(6992): Error: template std.algorithm.move does not match any function template declaration. Candidates are: /home/apua/Software/dmd/dmd/src/phobos/std/algorithm.d(1456): std.algorithm.move(T)(ref T source, ref T target) /home/apua/Software/dmd/dmd/src/phobos/std/algorithm.d(1549): std.algorithm.move(T)(ref T source) /home/apua/Software/dmd/dmd/src/phobos/std/algorithm.d(1456): Error: template std.algorithm.move cannot deduce template function from argument types !()(dchar,dchar) /home/apua/Software/dmd/dmd/src/phobos/std/algorithm.d(7000): Error: template std.algorithm.moveAll does not match any function template declaration. Candidates are: /home/apua/Software/dmd/dmd/src/phobos/std/algorithm.d(1705): std.algorithm.moveAll(Range1, Range2)(Range1 src, Range2 tgt) if (isInputRange!(Range1) && isInputRange!(Range2) && is(typeof(move(src.front, tgt.front)))) /home/apua/Software/dmd/dmd/src/phobos/std/algorithm.d(7000): Error: template std.algorithm.moveAll(Range1, Range2)(Range1 src, Range2 tgt) if (isInputRange!(Range1) && isInputRange!(Range2) && is(typeof(move(src.front, tgt.front)))) cannot deduce template function from argument types !()(string,string) flamenco.d(233): Error: template instance std.algorithm.remove!(cast(SwapStrategy)2, string, int) error instantiating /home/apua/Software/dmd/dmd/src/phobos/std/algorithm.d(6992): Error: template std.algorithm.move does not match any function template declaration. Candidates are: /home/apua/Software/dmd/dmd/src/phobos/std/algorithm.d(1456): std.algorithm.move(T)(ref T source, ref T target) /home/apua/Software/dmd/dmd/src/phobos/std/algorithm.d(1549): std.algorithm.move(T)(ref T source) /home/apua/Software/dmd/dmd/src/phobos/std/algorithm.d(1456): Error: template std.algorithm.move cannot deduce template function from argument types !()(dchar,dchar) /home/apua/Software/dmd/dmd/src/phobos/std/algorithm.d(7000): Error: template std.algorithm.moveAll does not match any function template declaration. Candidates are: /home/apua/Software/dmd/dmd/src/phobos/std/algorithm.d(1705): std.algorithm.moveAll(Range1, Range2)(Range1 src, Range2 tgt) if (isInputRange!(Range1) && isInputRange!(Range2) && is(typeof(move(src.front, tgt.front)))) /home/apua/Software/dmd/dmd/src/phobos/std/algorithm.d(7000): Error: template std.algorithm.moveAll(Range1, Range2)(Range1 src, Range2 tgt) if (isInputRange!(Range1) && isInputRange!(Range2) && is(typeof(move(src.front, tgt.front)))) cannot deduce template function from argument types !()(string,string) flamenco.d(234): Error: template instance std.algorithm.remove!(cast(SwapStrategy)2, string, ulong) error instantiating



So I changed them to
string stripPar(string S)
{
        while(S[0] == '(' && S[S.length-1] == ')')
        {
        
              S.remove(0);
              S.remove(S.length-1);
        }

        return S;
}
(i.e. not S = S.remove any more)

But I am having the smae error again ..

dmd 2.061 for 64 bit

Reply via email to