C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[29652] [질문]deque사용한 stl예제 인데요...
구리구리 [nkein82] 1363 읽음    2004-05-07 16:45
'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;

}


+ -

관련 글 리스트
29652 [질문]deque사용한 stl예제 인데요... 구리구리 1363 2004/05/07
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.