<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hamko&#039;s Blog &#187; DesignPattern</title>
	<atom:link href="https://home.wakatabe.com/ryo/blog/?cat=39&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>https://home.wakatabe.com/ryo/blog</link>
	<description>This is an Intellect Hamster.</description>
	<lastBuildDate>Wed, 16 Apr 2014 07:45:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<item>
		<title>C++コーディングパターン</title>
		<link>https://home.wakatabe.com/ryo/blog/?p=396</link>
		<comments>https://home.wakatabe.com/ryo/blog/?p=396#comments</comments>
		<pubDate>Thu, 17 Oct 2013 01:48:07 +0000</pubDate>
		<dc:creator>Hamko</dc:creator>
				<category><![CDATA[DesignPattern]]></category>

		<guid isPermaLink="false">http://home.wakatabe.com/ryo/blog/?p=396</guid>
		<description><![CDATA[1. virtual destructor destructorは継承される可能性があるなら必ずvirtualをつける。 2. compoundするとaccessorが大変なことになる問題。(m_algorithm.getData(i))->at(j)なんてやってられない。 (a) 参照一時変数に取っておいて、名前をわかりやすくして参照する。 (b) at(i, j)みたいなものを定義してやる。 のどちらかで解決する。 3. 副作用がインスタンスを生成する場合 (a) 副作用がインスタンスを生成するのを見過ごして、関数とデストラクタで責任を持つ。 (b) 生成するインスタンスを管理するクラスを作って、そのクラスの実体メンバ変数を用意し、副作用を実体への書き込みにする。 (c) 生成するインスタンスを呼び出し元に返してしまい、それをパラメータとして使うようにお願いする。 4. namespaceとstatic member functionについて namespaceは宣言をファイルで分割出来る。static member functionは継承状態を利用できる。 汎用的なツールはnamespaceに突っ込んで置いた方がよい。(e.g. include OpenGL)]]></description>
			<content:encoded><![CDATA[<p>1. virtual destructor<br />
destructorは継承される可能性があるなら必ずvirtualをつける。</p>
<p>2. compoundするとaccessorが大変なことになる問題。(m_algorithm.getData(i))->at(j)なんてやってられない。<br />
(a) 参照一時変数に取っておいて、名前をわかりやすくして参照する。<br />
(b) at(i, j)みたいなものを定義してやる。<br />
のどちらかで解決する。</p>
<p>3. 副作用がインスタンスを生成する場合<br />
(a) 副作用がインスタンスを生成するのを見過ごして、関数とデストラクタで責任を持つ。<br />
(b) 生成するインスタンスを管理するクラスを作って、そのクラスの実体メンバ変数を用意し、副作用を実体への書き込みにする。<br />
(c) 生成するインスタンスを呼び出し元に返してしまい、それをパラメータとして使うようにお願いする。</p>
<p>4. namespaceとstatic member functionについて<br />
namespaceは宣言をファイルで分割出来る。static member functionは継承状態を利用できる。<br />
汎用的なツールはnamespaceに突っ込んで置いた方がよい。(e.g. include OpenGL)</p>
]]></content:encoded>
			<wfw:commentRss>https://home.wakatabe.com/ryo/blog/?feed=rss2&#038;p=396</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
