map에 key 값이 존재하지 않을 때, [_key] 접근을 하게 되면 새로운 key-value 쌍이 생성된다.

key 값은 _key로, value는 기본 초기값을 가진다. (int의 경우 0, string의 경우 ""이다.)

 

 

 

 

 

삽입할 위치와 값을 전달 받아서 해당 위치에 원소를 삽입한다.

#include <iostream>
#include <list>

int main() {
    std::list<int> list1{ 1, 2, 3 };
    std::list<int> list2{ 4, 5, 6 };
    list1.insert(list1.end(), list2.begin(), list2.end());
    
    for (const auto& value : list1) {
        std::cout << value << " ";
    }
    std::cout << std::endl;

    return 0;
}

https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=pkk1113&logNo=220375082831 

 

 

행 하나하나를 select 해 와서 다른 테이블에 insert 한다.

 

insert into tbl_A
select sn, 0, 1, 0, 0, 0 from tbl_B where sn not in (
	select sn from tbl_A
)

tbl_A에는 없지만 B에는 있는 sn을 순서대로 가져와서 tbl_A에 일괄 지급한다.

'개인 공부 > STL' 카테고리의 다른 글

std::list::insert  (0) 2023.05.15
[unordered_set] 기본 자료형을 쓰지 않을 경우  (0) 2023.02.08
std::list erase시의 _Orphan_ptr에서 메모리 참조 오류  (0) 2022.12.07
std::find, std::find_if  (0) 2022.11.28
remove_if  (0) 2022.11.21



참고할 만한 사이트들

 

https://forums.ogre3d.org/viewtopic.php?t=36450 

 

deleting std::map and std::multimap - Ogre Forums

Get answers to all your basic programming questions. No Ogre questions, please! CMK2901 Gnoblar Posts: 5 Joined: Sat Oct 13, 2007 7:35 am Quote 0 login to like this post Post by CMK2901 » Tue Oct 16, 2007 6:03 am Hi everyone, I'm creating a key mapping cl

forums.ogre3d.org

 

https://community.intel.com/t5/Intel-C-Compiler/Window-x64-17-0-1-compiler-Visual-Studio-2015-and-std-list/m-p/1111107/highlight/true?profile.language=ko&countrylabel=Mexico 

 

Hello All,

Hello All, I and others have installed Update 2 the last three business days.  So far, testing shows the push_back problem on a debug build configuration is resolved.  However, the Visual Studio 2015, Update 3 repair has to occur to resolve the navy edit

community.intel.com

 

https://gpgstudy.com/forum/viewtopic.php?t=22762 

 

std::list erase시의 _Orphan_ptr에서의 이상한 오류 질문 - GpgStudy 포럼

프로그래밍 일반에 관한 포럼입니다. 운영자: 류광 비회원 전체글 글쓴이: 비회원 » 2009-03-31 15:19 안녕하세요, 다름이 아니라 아래와 같은 struct 에 대해서 만든 std::list 의 erase 시에 생기는 오류

gpgstudy.com

 

https://groups.google.com/g/microsoft.public.vc.stl/c/eqWLltz0p2Y/m/BDEWvLTmkTUJ?pli=1 

 

Crash in _Orphan_ptr

"Eddy" <Ed...@discussions.microsoft.com> wrote in message news:FA06DBEF-D3CF-4271...@microsoft.com > I have application in Visual Studio 2005 whose calls several DLLs. > I have a std::list created in the main application, > the same list is filled in a DLL

groups.google.com

 

 

★★★★★

https://blog.naver.com/PostView.naver?blogId=amcc&logNo=20203744808&parentCategoryNo=&categoryNo=&viewDate=&isShowPopularPosts=false&from=postView 

 

STL _Orphan_ptr 에서 Crash 날때

크게 많이 하는 실수가 2가지 경우가 있다.   1. 2개 이상의 스레드에서 접근하지만 동기화 시키지 않...

blog.naver.com

 

 

https://microsoft.public.vc.stl.narkive.com/EK3fn03G/crash-on-erase-not-in-a-loop

 

Crash on erase() - *not* in a loop

Post by Jim Keir typedef std::vector<PatchedFileInfo> FHList; FHList PatchedList; PatchedList[FileHandle[0]].Filename = asciiFileName; What's FileHandle? Are you sure FileHandle[0] is an integer between 0 and PatchedList.size() ? -- With best wishes, Igor

microsoft.public.vc.stl.narkive.com

https://stackoverflow.com/questions/16770179/what-std-lockit-does

 

What std::_lockit does?

I checked performance of c++ project and results are not so clear to me. std::_lockit::int() has over 20% of exclusive samples. What does it do and how do I avoid overusing it? I have a lot of things

stackoverflow.com

 

https://stackoverflow.com/questions/4006883/unnecessary-locking-in-stl-visual-c-express

 

Unnecessary locking in STL? (Visual C++ Express)

I'm trying to build a Tetris AI algorithm that can scale over multiple cores. In my tests it turns out that using multiple threads is slower than using a single thread. After some research I foun...

stackoverflow.com

 

https://stackoverflow.com/questions/61809337/orphan-range-crash-when-using-static-vector

 

_Orphan_range crash when using static vector

In my project, I use the constructor of a static object to collect pointers, like a registration method. Very simply, no magic. But during the start I experience a crash, and I can't explain what's

stackoverflow.com

 

'개인 공부 > STL' 카테고리의 다른 글

[unordered_set] 기본 자료형을 쓰지 않을 경우  (0) 2023.02.08
[mssql] 일괄 insert  (0) 2022.12.20
std::find, std::find_if  (0) 2022.11.28
remove_if  (0) 2022.11.21
remove와 erase  (0) 2022.11.21

std::find는 operator==가 정의되어 있을 때 사용 가능, 정의되어 있지 않다면 std::find_if에서 별도 비교식을 만들어 넣은 다음 사용 가능.

 

 

https://en.cppreference.com/w/cpp/algorithm/find

 

std::find, std::find_if, std::find_if_not - cppreference.com

(1) template< class InputIt, class T > InputIt find( InputIt first, InputIt last, const T& value ); (until C++20) template< class InputIt, class T > constexpr InputIt find( InputIt first, InputIt last, const T& value ); (since C++20) template< class Execut

en.cppreference.com

 

'개인 공부 > STL' 카테고리의 다른 글

[unordered_set] 기본 자료형을 쓰지 않을 경우  (0) 2023.02.08
[mssql] 일괄 insert  (0) 2022.12.20
std::list erase시의 _Orphan_ptr에서 메모리 참조 오류  (0) 2022.12.07
remove_if  (0) 2022.11.21
remove와 erase  (0) 2022.11.21

구조체 리스트에서 한 원소의 멤버변수 값을 비교해서 remove 하고자 할 때 이용.

 

https://thebook.io/080239/ch01/05/03-01/

 

코딩 테스트를 위한 자료 구조와 알고리즘 with C++: 1.5.3 연습 문제 3: 연결 리스트에서 remove_if() 함

 

thebook.io

 

https://openmynotepad.tistory.com/80

 

remove-erase 고찰

이 곳에 쓰인 모든 글은 Bjarne Stroustrup 교수님의 'The C++ Programming Language' 에서 발췌하여 직접 정리하였습니다. 1. 미리 알아둡시다. ( 대체 왜 remove랑 erase가 둘 다 있는거야? ) 기본적으로 표준 알고

openmynotepad.tistory.com

 

 

remove는 실제 원소 삭제가 이루어지는 게 아니라 move를 통해 값 덮어쓰기가 수행되는 것임.

'개인 공부 > STL' 카테고리의 다른 글

[unordered_set] 기본 자료형을 쓰지 않을 경우  (0) 2023.02.08
[mssql] 일괄 insert  (0) 2022.12.20
std::list erase시의 _Orphan_ptr에서 메모리 참조 오류  (0) 2022.12.07
std::find, std::find_if  (0) 2022.11.28
remove_if  (0) 2022.11.21

+ Recent posts