' P '

whatever I will forget

Entries from 2019-05-27 to 1 day

C++ <cstring>を使うメンバ変数が存在する場合のコンストラクタ定義

C++

なんかこれはメモっておいたほうがよいと思ったのでメモ! Testクラスに、char *strというメンバ変数が存在する場合です。 #include <cstring> #include <XXX.h> //XXX.hがローカルにあることを前提 //no args constructor Test::Test() //nullptrで初期化 : str{nullptr} { </xxx.h></cstring>…