counting characters

celavek via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 19 05:23:11 PDT 2016


On Tuesday, 19 July 2016 at 09:57:27 UTC, Lodovico Giaretta wrote:
> On Tuesday, 19 July 2016 at 09:42:40 UTC, celavek wrote:
>
> Works for me:
>
> size_t[char] counts;
> const string dna_chain = 
> "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC";
> counts['A'] = countchars(dna_chain, "A");

It was failing for me as I was using "countchars!". I thought 
that I should use the "!" in order to instantiate a template in 
D. I'm still confused why it is working without the "!". Anyway 
the compiler message was not very helpful.




More information about the Digitalmars-d-learn mailing list