STL関連の書籍に載っていたコードをそのまま記述しましたが、コンパイルでエラーとなりま
す。どうしてよいのかわかりません。どなたかご教授いただけませんか?
プログラムは以下のとおりです。環境はwin2000 vc6++ です。
#include<iostream>
#include<cassert>
#include<deque>
#include<algorithm>
using namespace std;
template <typename Container>
Container make(const char s[])
{
return Container(&s[0], &s[strlen(s)]);
}
int main()
{
cout << "
<< " << endl;
deque<char> deque1 =make< deque<char> >(C++ is a better C);
deque<char>::iterator
where = find(deque1.begin(), deque1.end(), 'e');
assert(*where == 'e' && *(where + 1) == 't');
cout << --- Ok. << endl;
return 0;
}
#include<iostream>
#include<cassert>
#include<deque>
#include<algorithm>
#include <iterator>
using namespace std;
template <typename Container>
Container make(const char s[])
{
Container result;
copy(s, s+strlen(s), back_inserter(result));
return result;
}
...以下同文
ありがとうございました。
これから、さらに理解できるように努力したいと思います。