|
'STL튜토리얼,레퍼런스 가이드2판'을 보고
이렇게 했는데
error C2665: 'deque<char,class std::allocator<char> >::deque<char,class std::allocator<char> >' : none of the 4 overloads can convert parameter 1 from type 'const char *'
see reference to function template instantiation 'class std::deque<char,class std::allocator<char> > __cdecl make(const char [])' being compiled
이런 에러가 나서 실행이 안되네요...
#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 << "Demonstrating generic find algorithm with a list." << 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;
}
|