Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- dynamic_cast
- placement new
- virtual function table
- operator overloading
- std::vector
- 더 지니어스 양면포커
- c++ multi chatting room
- c++ basic practice
- constructor
- virtual inheritance
- member function pointer
- vector size
- std::endl
- return by reference
- pointer to member data
- discord bot
- virtual destructor
- vector capacity
- base from member
- std::ostream
- this call
- virtual function
- std::cout
- delete function
- conversion constructor
- suffix return type
- C++
- increment operator
- new&delete
- diamond inheritance
Archives
- Today
- Total
목록placement new (1)
I'm FanJae.

1. new와 delete 1-1. new와 delete의 원리#include class Point{ int x, y;public: Point(int a, int b) : x{a}, y{b} { std::cout Point* p1 = new Point(1,2);- 위와 같이 쓰면 크게 2가지 작업을 진행한다. 즉, new를 실행하면 아래와 같은 2가지가 실행되는 것이다. ① 메모리할당 void *p = operator new(sizeof(Point))② 생성자호출 Point *p1 = new(p) Point(1,2);- 여기서 new(p) Point(1,2); 와 같은 표기법을 placement new라고 한다. delete p1;- 위와 같이 쓰면 크게 2가지 작업을 진행한다. 즉, delet..
C++/Intermediate
2024. 9. 18. 21:36