www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11013] New: ignoring variable inside the predicate of findSplitBefore

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11013

           Summary: ignoring variable inside the predicate of
                    findSplitBefore
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: alienballance gmail.com


--- Comment #0 from Mariusz GliwiƄski <alienballance gmail.com> 2013-09-11
14:00:25 PDT ---
I missed some functionality in std.algorithm, so i decided to use
findSplitBefore for my purpose.

Here is the code: 
http://dpaste.dzfl.pl/68f9ba62

Unfortunately, ignoring second variable in pred, results in compilation error
like this:

/opt/compilers/dmd2/include/std/algorithm.d(4292): Error: template
std.algorithm.find matches more than one template declaration,
/opt/compilers/dmd2/include/std/algorithm.d(3504):find(alias pred = "a == b",
R, E)(R haystack, E needle) if (isInputRange!(R) &&
is(typeof(binaryFun!(pred)(haystack.front, needle)) : bool)) and
/opt/compilers/dmd2/include/std/algorithm.d(3555):find(alias pred = "a == b",
R1, R2)(R1 haystack, R2 needle) if (isForwardRange!(R1) && isForwardRange!(R2)
&& is(typeof(binaryFun!(pred)(haystack.front, needle.front)) : bool) &&
!isRandomAccessRange!(R1))
/opt/compilers/dmd2/include/std/range.d(611): Error: static assert  "Cannot put
a char[] into a Appender!(string)"
/opt/compilers/dmd2/include/std/format.d(1433):        instantiated from here:
put!(Appender!(string), char[])
/opt/compilers/dmd2/include/std/format.d(1335):        instantiated from here:
formatUnsigned!(Appender!(string), char)
/opt/compilers/dmd2/include/std/format.d(1309):        instantiated from here:
formatIntegral!(Appender!(string), ulong, char)
/opt/compilers/dmd2/include/std/format.d(2950):        ... (5 instantiations,
-v to show) ...
/opt/compilers/dmd2/include/std/algorithm.d(4294):        instantiated from
here: tuple!(string, string)
/d682/f882.d(6):        instantiated from here: findSplitBefore!("a==a",
string, string)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 11 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=11013


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-09-11
19:23:33 PDT ---
Please paste small code examples inline, thanks!

-----
import std.algorithm : findSplitBefore;

void main()
{
    auto var = "abc";
    var.findSplitBefore!q{a==a}(var);
}
-----

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 11 2013