"STL"의 두 판 사이의 차이

jjuiddong
이동: 둘러보기, 찾기
3번째 줄: 3번째 줄:
 
** copy(test.begin(), test.end(), ostream_iterator<int>(cout, "\n") );
 
** copy(test.begin(), test.end(), ostream_iterator<int>(cout, "\n") );
 
** STLpractice/GenralPrinting, STLpractice/SetTest 를 참고하자.
 
** STLpractice/GenralPrinting, STLpractice/SetTest 를 참고하자.
 +
  
 
* set<T> 은 중복된 데이타를 제거하고, unique한 값만 저장한다.
 
* set<T> 은 중복된 데이타를 제거하고, unique한 값만 저장한다.
 +
  
 
* ifstream 으로 읽은 파일 정보를 모두 string에 넣기
 
* ifstream 으로 읽은 파일 정보를 모두 string에 넣기
 
** std::string str((std::istreambuf_iterator<char>(input)), std::istreambuf_iterator<char>());
 
** std::string str((std::istreambuf_iterator<char>(input)), std::istreambuf_iterator<char>());
 +
  
 
* std::string 대소문자 구분없이 비교하기
 
* std::string 대소문자 구분없이 비교하기
 
** #include <boost/algorithm/string.hpp>
 
** #include <boost/algorithm/string.hpp>
 
** if (boost::iequals(str, tag))
 
** if (boost::iequals(str, tag))
 +
  
 
* vector, list 초기화
 
* vector, list 초기화
 
** std::vector v(10,1);  // 벡터 v를 10개의 배열을 1로 초기화한다.
 
** std::vector v(10,1);  // 벡터 v를 10개의 배열을 1로 초기화한다.
 
** std::fill(m_vector.begin(), m_vector.end(), 20);
 
** std::fill(m_vector.begin(), m_vector.end(), 20);

2014년 2월 11일 (화) 10:28 판

  • container 에 있는 내용을 쉽게 출력하는 법
    • copy(test.begin(), test.end(), ostream_iterator<int>(cout, "\n") );
    • STLpractice/GenralPrinting, STLpractice/SetTest 를 참고하자.


  • set<T> 은 중복된 데이타를 제거하고, unique한 값만 저장한다.


  • ifstream 으로 읽은 파일 정보를 모두 string에 넣기
    • std::string str((std::istreambuf_iterator<char>(input)), std::istreambuf_iterator<char>());


  • std::string 대소문자 구분없이 비교하기
    • #include <boost/algorithm/string.hpp>
    • if (boost::iequals(str, tag))


  • vector, list 초기화
    • std::vector v(10,1); // 벡터 v를 10개의 배열을 1로 초기화한다.
    • std::fill(m_vector.begin(), m_vector.end(), 20);
개인 도구
이름공간

변수
행위
둘러보기
도구모음