{"id":885,"date":"2015-06-10T20:09:32","date_gmt":"2015-06-11T05:09:32","guid":{"rendered":"http:\/\/blog.box.kr\/?p=885"},"modified":"2015-06-10T20:09:32","modified_gmt":"2015-06-11T05:09:32","slug":"tip-for-auto_ptr-with-c","status":"publish","type":"post","link":"https:\/\/blog.box.kr\/?p=885","title":{"rendered":"tip for auto_ptr with C++"},"content":{"rendered":"<p>1. how to test whether auto_pointer is null?<\/p>\n<blockquote>\n<pre class=\"lang-cpp prettyprint prettyprinted\"><code><span class=\"kwd\">if<\/span> <span class=\"pun\">(!<\/span><span class=\"pln\">myPointer<\/span><span class=\"pun\">.<\/span><span class=\"pln\">get<\/span><span class=\"pun\">())<\/span> <span class=\"pun\">{<\/span>\n    <span class=\"com\">\/\/ do not dereference here<\/span>\n<span class=\"pun\">}<\/span><\/code><\/pre>\n<\/blockquote>\n<p>2. how to pass auto_pointer ?<\/p>\n<blockquote><p>std::auto_ptr&lt;class&gt; \u00a0ptr_class = std::auto_ptr( new class );<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>1. how to test whether auto_pointer is null? if (!myPointer.get()) { \/\/ do not dereference here } 2. how to pass auto_pointer ? std::auto_ptr&lt;class&gt; \u00a0ptr_class = std::auto_ptr( new class );<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"ngg_post_thumbnail":0,"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[9],"tags":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5q9Zn-eh","jetpack-related-posts":[{"id":335,"url":"https:\/\/blog.box.kr\/?p=335","url_meta":{"origin":885,"position":0},"title":"\uc815\uaddc\ud45c\ud604\uc2dd(Regular Expression) on C++","date":"2014-08-11","format":false,"excerpt":"*\u00a0C++ Regex 2011\ub144 \uacbd C++\uc758 \uc0c8\ub85c\uc6b4 \ud45c\uc900 C++11 (C++0x)\uc744 \uc815\uc758\ud558\ub294 \uacfc\uc815\uc5d0\uc11c Boost.Regex\uac00 \ud45c\uc900\uc73c\ub85c \ud3ec\ud568\ub418\uc5c8\ub2e4. C++11\uc758 \uc815\uaddc\ud45c\ud604\uc2dd \ub77c\uc774\ube0c\ub7ec\ub9ac\ub294 <regex> \ud5e4\ub354\uc5d0 \uc815\uc758\ub418\uc5b4 \uc788\ub2e4.\uc774\ub85c \uc778\ud574 \ubcc4\ub3c4\uc758 \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \uc124\uce58\ud558\uc9c0 \uc54a\uace0\ub3c4 \uc190\uc27d\uac8c \uc815\uaddc\ud45c\ud604\uc2dd \uae30\ub2a5\uc744 \ud65c\uc6a9\ud560 \uc218 \uc788\uac8c \ub418\uc5c8\ub2e4. \ucd5c\uc2e0 \ubc84\uc804\uc758 Visual C++, GNU C++ \ucef4\ud30c\uc77c\ub7ec\ub294 std::regex\ub97c \ud3ec\ud568\ud55c C++11 \ud45c\uc900\uc774 \uc815\uc758\ud55c \ub300\ubd80\ubd84\uc758 \uae30\ub2a5\uc744 \uc9c0\uc6d0\ud55c\ub2e4. \ucef4\ud30c\uc77c\ub7ec\ubcc4 C++11\u2026","rel":"","context":"In &quot;C\/C++&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":339,"url":"https:\/\/blog.box.kr\/?p=339","url_meta":{"origin":885,"position":1},"title":"[c++11] \uc798 \uc4f0\uba74 \ub9e4\uc6b0 \ud3b8\ub9ac\ud55c C++11\uc758 \ubb38\ubc95\ub4e4","date":"2014-08-12","format":false,"excerpt":"C\/C++\uc5b8\uc5b4\ub294 \uc800\uc218\uc900\uae4c\uc9c0 \uc815\ubc00\ud558\uac8c \ub2e4\ub8f0 \uc218 \uc788\ub294 \ubc18\uba74, \ud504\ub85c\uadf8\ub798\uba38\uac00 \uc77c\uc77c\ud788 \uad00\ub9ac\ud574\uc918\uc57c\ud558\ub294 \ubd80\ubd84\uc774 \ub9ce\ub2e4\ub294\uac8c C\/C++\uc5b8\uc5b4\uc5d0 \ub300\ud55c \uc77c\ubc18\uc801\uc778 \uacac\ud574\uc785\ub2c8\ub2e4. \uadf8\ub798\uc11c \uc800\uc218\uc900\uae4c\uc9c0 \uc77c\uc77c\ud788 \uc2e0\uacbd\uc4f0\uc9c0 \uc54a\uc544\ub3c4 \ub418\ub294 \ucfe8\ud55c \uc5b8\uc5b4\ub97c \uac00\uc9c0\uace0 \ub192\uc740 \uc0dd\uc0b0\uc131\uc744 \ucd94\uad6c\ud558\ub294\uac8c \ucd94\uc138\uc774\uae30\ub3c4 \ud569\ub2c8\ub2e4. . . . \ub9cc, C++\uc758 \uace8\uc218\ube60\ub85c\uc11c C++11\uc744 \ud1b5\ud574 C++\ub85c\ub3c4 \ucda9\ubd84\ud788 \ucfe8\ud558\uace0 \uc0dd\uc0b0\uc131 \ub192\uc740 \ucf54-\ub4dc\ub97c \uc791\uc131\ud560\uc218 \uc788\ub2e4\uace0 \ubcc0\ud638\ub97c \ud574\ubcf4\ub824\uace0 \ud569\ub2c8\ub2e4. Visual\u2026","rel":"","context":"In &quot;C\/C++&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":143,"url":"https:\/\/blog.box.kr\/?p=143","url_meta":{"origin":885,"position":2},"title":"Splitting a C++ std::string using tokens, e.g. \u201c;\u201d [duplicate]","date":"2014-06-29","format":false,"excerpt":"std::vector<std::string> split(const std::string& s,char seperator){ std::vector<std::string> output; std::string::size_type prev_pos =0, pos =0;while((pos = s.find(seperator, pos))!= std::string::npos){ std::string substring( s.substr(prev_pos, pos-prev_pos)); output.push_back(substring); prev_pos =++pos;} output.push_back(s.substr(prev_pos, pos-prev_pos));\/\/ Last wordreturn output;}","rel":"","context":"In &quot;C\/C++&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":230,"url":"https:\/\/blog.box.kr\/?p=230","url_meta":{"origin":885,"position":3},"title":"std::string \ub2e4\ub8e8\uae30.. ( \ucc3e\uae30, \uacf5\ubc31\uc81c\uac70 \ub4f1\ub4f1)","date":"2014-07-23","format":false,"excerpt":"\ubb38\uc790\uc5f4 string #include \"StdAfx.h\" #include \"StringTest.h\" #include <algorithm> \/\/transform \uc0ac\uc6a9 #include <functional> \/\/bind1st using std::string; \/\/ \uc774\ub807\uac8c \uc9c0\uc815\ud574\uc900\ub2e4. StringTest::StringTest() { log(\"StringTest \uc0dd\uc131\uc790 \ud638\ucd9c\"); } StringTest::~StringTest(void) { log(\"StringTest \uc18c\uba78\uc790 \ud638\ucd9c\"); } void StringTest::test() { log(\"============ string class ==========\"); \/\/ \uc0dd\uc131\uc790 \u00a0 std::string s0; \/\/ \ube44\uc5b4\uc788\ub294 string std::string s1(\"012345\",3); \/\/ \uacb0\uacfc: 012\u2026","rel":"","context":"In &quot;C\/C++&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":867,"url":"https:\/\/blog.box.kr\/?p=867","url_meta":{"origin":885,"position":4},"title":"FIX8 lib. install on OSX","date":"2015-06-02","format":false,"excerpt":"1. open source download http:\/\/fix8.org\/downloads.html 2. un tar 3. brew install automake 4. brew install poco 5. configure --with-poco=\/usr\/local\/opt\/poco 6. make 7. but... error In file included from xml.cpp:38: In file included from ..\/include\/fix8\/f8includes.hpp:84: ..\/include\/fix8\/tickval.hpp:67:34: error: in-class initializer for static data member is not a constant expression static const ticks\u2026","rel":"","context":"In &quot;\uae30\uc220&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":178,"url":"https:\/\/blog.box.kr\/?p=178","url_meta":{"origin":885,"position":5},"title":"std::map example","date":"2014-07-09","format":false,"excerpt":"\/\/ std::map example \/\/ opposite words #include <iostream> #include <map> #include <string> using namespace std; typedef std::map<std::string, std::string> TStrStrMap; typedef std::pair<std::string, std::string> TStrStrPair; int main(int argc, char *argv[]) { TStrStrMap tMap; tMap.insert(TStrStrPair(\"yes\", \"no\")); tMap.insert(TStrStrPair(\"up\", \"down\")); tMap.insert(TStrStrPair(\"left\", \"right\")); tMap.insert(TStrStrPair(\"good\", \"bad\")); std::string s; std::cout << \"Enter word: \" << std::endl;; std::cin >>\u2026","rel":"","context":"In &quot;C\/C++&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/blog.box.kr\/index.php?rest_route=\/wp\/v2\/posts\/885"}],"collection":[{"href":"https:\/\/blog.box.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.box.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.box.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.box.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=885"}],"version-history":[{"count":0,"href":"https:\/\/blog.box.kr\/index.php?rest_route=\/wp\/v2\/posts\/885\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.box.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=885"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.box.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=885"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.box.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=885"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}