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 |
Tags
- 핑거스타일
- Visual Studio
- 기타 연주
- Python
- 채보
- error
- 오류
- C
- Numpy
- Linux
- JSON
- windows forms
- LIST
- mysql
- OpenCV
- C#
- YOLO
- pip
- VS Code
- 프로그래머스
- paramiko
- 컨테이너
- C++
- pytorch
- label
- Docker
- SSH
- Selenium
- pandas
- ubuntu
Archives
- Today
- Total
목록얕은 복사 (2)
기계는 거짓말하지 않는다
Python 깊은 복사, 얕은 복사 (Shallow Copy, Deep Copy)
Python의 list 복사를 예시로 들 수 있다. 얕은 복사(Shallow Copy)는 list 뿐 아니라 mutable 객체 모두 문제가 된다. Docs: Python copy module copy — Shallow and deep copy operations Source code: Lib/copy.py Assignment statements in Python do not copy objects, they create bindings between a target and an object. For collections that are mutable or contain mutable items, a copy ... docs.python.org List 초기화 # 2차원 list 10행 5열 생성, 초기..
Python
2023. 2. 12. 22:05
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bsc2eg/btq5g5vdEQp/BleHgu6vjNK1tXkzxbXdZ0/img.png)
class, struct 에 동적 할당하여 사용하는 포인터가 있다면 문제가 될 수 있다. 얕은 복사(Shallow Copy) #include #include using namespace std; class A { private: char * str; int num; public: A(const char* oStr, int oNum) { int len = strlen(oStr) + 1; str = new char[len]; strcpy_s(str, len, oStr); num = oNum; } void PrintData() { cout
C++
2021. 5. 18. 19:18