By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,938 Members | 1,578 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,938 IT Pros & Developers. It's quick & easy.

string literal does not match array template parameter

P: n/a
The purpose of the following code is to search a string for
a substring, and replace the first character of the found string
with a new value:

#include <algorithm>
#include <string>

template<typename InIt, typename CharT, int N>
void filter(InIt begin, InIt end, CharT const (&needle)[N], CharT
new_ch)
{
while (end != (begin = std::search(begin, end, needle, needle + N -
1)))
*begin++ = new_ch;
}

int main()
{
std::string s("bar");
filter(s.begin(), s.end(), "hi", 'H');
}

On GCC 3.4.1 it compiles correctly, but on BCC 5.5.1 I get the
error:

Could not find a match for filter<InIt,CharT,N>
(char *, char *, char *, char)

Is BCC wrong?

Jul 23 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.