일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- vim
- nestjs
- IOS
- @Environment
- RxCocoa
- subject
- NullObject
- init?
- RFC1738/1808
- init
- Operators
- operator
- dismiss
- graphql
- SWIFT
- @Binding
- nonisolated
- SwiftUI
- NavigationLink
- typeorm
- Operater
- ios14
- RxSwift
- @State
- @EnvironmentObject
- swift6
- Xcode
- URL(string:)
- Creating Operators
- Bug
- Today
- Total
목록Development (144)
Tunko Development Diary
for(std::vector::iterator iter = m_vecP.begin(); iter != m_vecP.end(); ){ if((*iter).rank == rank) iter = m_vecP.erase(iter); else ++iter;} 벡터의 요소를 for 문으로 돌면서, 조건을 만족하는경우 요소를 삭제하고 그렇지 않은경우 다음요소로 넘어가야하는 경우는 자주발생한다. 이럴 때, 단순히 erase(iter) 로 요소를 삭제하면 그 다음요소로의 반복자(iterator)가 무효화되어 버리므로, 오류를 발생시킨다. 다행히 erase 함수는 지울요소의 바로다음 반복자를 리턴하므로 이 반복자를 받아서 사용하자. 주의할점은, for 문 자체 반복증감요소는 제거하여야 한다는것이다.
moveby, moveto 차이점 MoveTo : 지정한 좌표로의 이동MoveBy : 현재 좌표에서 주어진 값만큼 이동
std::string to_str(int t) { std::stringstream ss; ss
// stoi example #include // std::cout #include // std::string, std::stoi int main () { std::string str_dec = "2001, A Space Odyssey"; std::string str_hex = "40c3"; std::string str_bin = "-10010110001"; std::string str_auto = "0x7f"; std::string::size_type sz; // alias of size_t int i_dec = std::stoi (str_dec,&sz); int i_hex = std::stoi (str_hex,nullptr,16); int i_bin = std::stoi (str_bin,nullptr..