본문 바로가기

Coding Memo

검색하기
Coding Memo
프로필사진 minttea25

  • 분류 전체보기 (163)
    • Language (78)
      • C++ (37)
      • C# (18)
      • Kotlin (20)
      • Python (3)
    • Unreal Engine (1)
    • Android (2)
    • Unity (8)
    • 문제풀이 (12)
      • BOJ (11)
      • Code Forces (1)
    • Game Server (C++) (18)
    • 메모 (12)
    • Icons (1)
    • etc (29)
Guestbook
Notice
Recent Posts
Recent Comments
Link
Tags
  • tcp
  • Java
  • 유니티
  • c#
  • C++
  • template
  • 디자인패턴
  • 직렬화
  • serialization
  • 데이터베이스
  • Socket Programming
  • Visual Studio
  • 백준
  • error
  • MariaDB
  • Lock
  • protobuf
  • 메모리
  • Unity
  • 디자인 패턴
  • Server
  • SOCKET
  • 에러
  • db
  • winsock
  • database
  • OVERLAPPED
  • aws
  • RDS
  • Singleton
more
Archives
Today
Total
관리 메뉴
  • 글쓰기
  • 방명록
  • RSS
  • 관리

목록스마트포인터 (1)

Coding Memo

Reference Counting

본 포스팅은 인프런에 등록되어 있는 Rockiss 님의 강의를 보고 간단하게 작성한 글입니다. 아래 코드를 살펴보자 #pragma once #include #include using namespace std; class A { public: int v = 10; }; class B { public: B() {} void SetRef(A* a) { _ref = a; } void DoSomethingWithRef() { _ref->v += 1; } private: A* _ref = nullptr; }; int main() { A* a = new A(); B* b = new B(); b->SetRef(a); // 어떤 이유로 A가 소멸됨 delete a; while (true) { if (b) { b->DoS..

Game Server (C++) 2022. 9. 30. 16:00
이전 Prev 1 Next 다음

Blog is powered by kakao / Designed by Tistory

티스토리툴바