std.algorithms filter and string[]
Russel Winder
russel at winder.org.uk
Wed Apr 11 06:55:33 PDT 2012
I am having a dumb n00b moment, but I need to solve this 10 mins ago ;-)
immutable files = ( selector == 0 ) ? [ "." ] : filter ! ( ( string x ) { return x.isFile ; } ) ( sliceOfStrings ) ;
gives me the error:
Error: incompatible types for ((["."]) ? (filter(sliceOfStrings))):
'string[]' and 'Result'
which in one universe is fine, but in my universe is a problem as I
cannot see a way of properly creating a Result instance based on the
array literal.
(I have a workaround, but I'd prefer to know the proper D idiom for
this.
Thanks.
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder at ekiga.net
41 Buckmaster Road m: +44 7770 465 077 xmpp: russel at winder.org.uk
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120411/d7cff8dd/attachment.pgp>
More information about the Digitalmars-d
mailing list