<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Commentaires sur : Préprocesseur et énumérations : la suite.</title>
	<atom:link href="http://www.coder-studio.com/blog/preprocesseur-et-enumerations-la-suite/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.coder-studio.com/blog/preprocesseur-et-enumerations-la-suite/</link>
	<description></description>
	<lastBuildDate>Wed, 21 Jul 2010 13:51:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>Par : automatic directory submission</title>
		<link>http://www.coder-studio.com/blog/preprocesseur-et-enumerations-la-suite/comment-page-1/#comment-202</link>
		<dc:creator>automatic directory submission</dc:creator>
		<pubDate>Thu, 15 Jul 2010 19:48:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.coder-studio.com/blog/?p=393#comment-202</guid>
		<description>Reach the good manual directory submission services, if you want your web site&#039;s traffic to be better.</description>
		<content:encoded><![CDATA[<p>Reach the good manual directory submission services, if you want your web site&#8217;s traffic to be better.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Par : Virginia</title>
		<link>http://www.coder-studio.com/blog/preprocesseur-et-enumerations-la-suite/comment-page-1/#comment-192</link>
		<dc:creator>Virginia</dc:creator>
		<pubDate>Wed, 16 Jun 2010 06:10:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.coder-studio.com/blog/?p=393#comment-192</guid>
		<description>Hello! I simply wanted to say your site is one of the nicely laid out, most inspirational I have come across in quite a while. Thx! :)</description>
		<content:encoded><![CDATA[<p>Hello! I simply wanted to say your site is one of the nicely laid out, most inspirational I have come across in quite a while. Thx! <img src='http://www.coder-studio.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>Par : Calvin1602</title>
		<link>http://www.coder-studio.com/blog/preprocesseur-et-enumerations-la-suite/comment-page-1/#comment-82</link>
		<dc:creator>Calvin1602</dc:creator>
		<pubDate>Sun, 26 Jul 2009 22:31:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.coder-studio.com/blog/?p=393#comment-82</guid>
		<description>// Enumerate.h
 
#ifndef ENUMERATE_H
#define ENUMERATE_H
 
#define MAKE_ENUM(enum_name, ...)	\
	enum enum_name { __VA_ARGS__ };
 
#define ENUM_CASE_1(val) #val ,
 
#define ENUM_CASE_2(val, ...)	ENUM_CASE_1(val) ENUM_CASE_1(__VA_ARGS__)
#define ENUM_CASE_3(val, ...)	ENUM_CASE_1(val) ENUM_CASE_2(__VA_ARGS__)
#define ENUM_CASE_4(val, ...)	ENUM_CASE_1(val) ENUM_CASE_3(__VA_ARGS__)
#define ENUM_CASE_5(val, ...)	ENUM_CASE_1(val) ENUM_CASE_4(__VA_ARGS__)
#define ENUM_CASE_6(val, ...)	ENUM_CASE_1(val) ENUM_CASE_5(__VA_ARGS__)
#define ENUM_CASE_7(val, ...)	ENUM_CASE_1(val) ENUM_CASE_6(__VA_ARGS__)
#define ENUM_CASE_8(val, ...)	ENUM_CASE_1(val) ENUM_CASE_7(__VA_ARGS__)
#define ENUM_CASE_9(val, ...)	ENUM_CASE_1(val) ENUM_CASE_8(__VA_ARGS__)
#define ENUM_CASE_10(val, ...)	ENUM_CASE_1(val) ENUM_CASE_9(__VA_ARGS__)
 
#define MAKE_OPERATOR(enum_name, ...)	\
	inline std::ostream&amp; operator&lt;&lt;(std::ostream&amp; os, const enum_name&amp; e)	{\
		static const char * v[]={ \
			ENUM_CASE_10(__VA_ARGS__)	\
		}; os &lt;&lt; v[e];	\
		return os;	\
	}
 
 
#define ENUMERATE(enum_name, ...)	\
	MAKE_ENUM(enum_name, __VA_ARGS__)	\
	MAKE_OPERATOR(enum_name, __VA_ARGS__)
 
#endif // ENUMERATE_H


et 


ENUMERATE(MonEnumeration,
	E_VAL_1,
	E_VAL_2,
	E_VAL_3);


int main()
{
	MonEnumeration e = E_VAL_2;
	std::cout &lt;&lt; e &lt;&lt; std::endl;
	return 0;
}</description>
		<content:encoded><![CDATA[<p>// Enumerate.h</p>
<p>#ifndef ENUMERATE_H<br />
#define ENUMERATE_H</p>
<p>#define MAKE_ENUM(enum_name, &#8230;)	\<br />
	enum enum_name { __VA_ARGS__ };</p>
<p>#define ENUM_CASE_1(val) #val ,</p>
<p>#define ENUM_CASE_2(val, &#8230;)	ENUM_CASE_1(val) ENUM_CASE_1(__VA_ARGS__)<br />
#define ENUM_CASE_3(val, &#8230;)	ENUM_CASE_1(val) ENUM_CASE_2(__VA_ARGS__)<br />
#define ENUM_CASE_4(val, &#8230;)	ENUM_CASE_1(val) ENUM_CASE_3(__VA_ARGS__)<br />
#define ENUM_CASE_5(val, &#8230;)	ENUM_CASE_1(val) ENUM_CASE_4(__VA_ARGS__)<br />
#define ENUM_CASE_6(val, &#8230;)	ENUM_CASE_1(val) ENUM_CASE_5(__VA_ARGS__)<br />
#define ENUM_CASE_7(val, &#8230;)	ENUM_CASE_1(val) ENUM_CASE_6(__VA_ARGS__)<br />
#define ENUM_CASE_8(val, &#8230;)	ENUM_CASE_1(val) ENUM_CASE_7(__VA_ARGS__)<br />
#define ENUM_CASE_9(val, &#8230;)	ENUM_CASE_1(val) ENUM_CASE_8(__VA_ARGS__)<br />
#define ENUM_CASE_10(val, &#8230;)	ENUM_CASE_1(val) ENUM_CASE_9(__VA_ARGS__)</p>
<p>#define MAKE_OPERATOR(enum_name, &#8230;)	\<br />
	inline std::ostream&amp; operator&lt;&lt;(std::ostream&amp; os, const enum_name&amp; e)	{\<br />
		static const char * v[]={ \<br />
			ENUM_CASE_10(__VA_ARGS__)	\<br />
		}; os &lt;&lt; v[e];	\<br />
		return os;	\<br />
	}</p>
<p>#define ENUMERATE(enum_name, &#8230;)	\<br />
	MAKE_ENUM(enum_name, __VA_ARGS__)	\<br />
	MAKE_OPERATOR(enum_name, __VA_ARGS__)</p>
<p>#endif // ENUMERATE_H</p>
<p>et </p>
<p>ENUMERATE(MonEnumeration,<br />
	E_VAL_1,<br />
	E_VAL_2,<br />
	E_VAL_3);</p>
<p>int main()<br />
{<br />
	MonEnumeration e = E_VAL_2;<br />
	std::cout &lt;&lt; e &lt;&lt; std::endl;<br />
	return 0;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>Par : Calvin1602</title>
		<link>http://www.coder-studio.com/blog/preprocesseur-et-enumerations-la-suite/comment-page-1/#comment-81</link>
		<dc:creator>Calvin1602</dc:creator>
		<pubDate>Sun, 26 Jul 2009 22:05:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.coder-studio.com/blog/?p=393#comment-81</guid>
		<description>Toujours pas motivé par le tableau indexé par l&#039;enum ? ^^
Sinon ya pas vraiment de limitation à 10, suffit d&#039;augmenter la taille du code source :D Boost est limité à 256, je crois. Ya un fichier où ya que ça : les 256 versions de la même macro ^^</description>
		<content:encoded><![CDATA[<p>Toujours pas motivé par le tableau indexé par l&#8217;enum ? ^^<br />
Sinon ya pas vraiment de limitation à 10, suffit d&#8217;augmenter la taille du code source <img src='http://www.coder-studio.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Boost est limité à 256, je crois. Ya un fichier où ya que ça : les 256 versions de la même macro ^^</p>
]]></content:encoded>
	</item>
	<item>
		<title>Par : Funto</title>
		<link>http://www.coder-studio.com/blog/preprocesseur-et-enumerations-la-suite/comment-page-1/#comment-77</link>
		<dc:creator>Funto</dc:creator>
		<pubDate>Thu, 16 Jul 2009 22:22:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.coder-studio.com/blog/?p=393#comment-77</guid>
		<description>Merci :)

+ de 200, j&#039;avais pas vu...là effectivement, ça fait bcp O_o

Mais si on veut éviter d&#039;être limité par le nombre de valeurs, on ne peut plus avoir recours à la pseudo-récursivité de macros alors, et là je vois pas vraiment comment faire...sinon faire comme sur le lien que j&#039;ai indiqué, avec des templates, mais ça ne définit pas une &quot;vraie&quot; énumération.

Ceci dit, contrairement à ce que tu m&#039;as montré, là c&#039;est géré en statique...

PS : ton avatar est énorme, Rody powa :)</description>
		<content:encoded><![CDATA[<p>Merci <img src='http://www.coder-studio.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>+ de 200, j&#8217;avais pas vu&#8230;là effectivement, ça fait bcp O_o</p>
<p>Mais si on veut éviter d&#8217;être limité par le nombre de valeurs, on ne peut plus avoir recours à la pseudo-récursivité de macros alors, et là je vois pas vraiment comment faire&#8230;sinon faire comme sur le lien que j&#8217;ai indiqué, avec des templates, mais ça ne définit pas une &laquo;&nbsp;vraie&nbsp;&raquo; énumération.</p>
<p>Ceci dit, contrairement à ce que tu m&#8217;as montré, là c&#8217;est géré en statique&#8230;</p>
<p>PS : ton avatar est énorme, Rody powa <img src='http://www.coder-studio.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>Par : Twxs</title>
		<link>http://www.coder-studio.com/blog/preprocesseur-et-enumerations-la-suite/comment-page-1/#comment-72</link>
		<dc:creator>Twxs</dc:creator>
		<pubDate>Wed, 15 Jul 2009 20:59:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.coder-studio.com/blog/?p=393#comment-72</guid>
		<description>le seul truc qui me gène c&#039;est la limite du nombre d&#039;enum, par exemple l&#039;enum que je t&#039;ai montré ce midi a plus de 200 elements, mis a part ce point c&#039;est très beau!</description>
		<content:encoded><![CDATA[<p>le seul truc qui me gène c&#8217;est la limite du nombre d&#8217;enum, par exemple l&#8217;enum que je t&#8217;ai montré ce midi a plus de 200 elements, mis a part ce point c&#8217;est très beau!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
