Hi,<div><br></div><div>Both calng++ and g++ with libc++ fail to compile the attached piece of code,</div><div>$ clang++ -std=c++0x -stdlib=libc++ unordered_map.cpp</div><div><br></div><div><div>In file included from ./unordered_map.cpp:1:</div>
<div>/usr/include/c++/v1/string:1031:35: error: no type named 'char_type' in</div><div> 'Parameter'</div><div> typedef typename traits_type::char_type value_type;</div><div> ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~</div>
</div><div><br></div><div>(lots of error messages)</div><div><br></div><div><br></div><div>However, it can be compiled against libstdc++</div><div>$ calng++ -std=c++0x unordered_map.cpp</div><div><br></div><div>I'm not sure if the program conforms strictly to the standard or it's a bug in libc++.</div>
<div>Any comment will be appreciated.</div><div><br></div><div>Thanks,</div><div><br></div><div>Ryuta</div><div><br></div><div><div>#include <string></div><div>#include <map></div><div>#include <unordered_map></div>
<div><br></div><div>class Parameter</div><div>{</div><div> public:</div><div> explicit Parameter( bool arg );</div><div> Parameter();</div><div> ~Parameter();</div><div><br></div><div> unsigned int offset;</div>
<div> bool argument;</div><div>};</div><div><br></div><div>class PTXKernel</div><div>{</div><div> typedef std::map<std::string,Parameter> ParameterMap;</div><div><br></div><div> public:</div><div> PTXKernel( const std::string& name = "" );</div>
<div> PTXKernel( const PTXKernel& k );</div><div> ~PTXKernel();</div><div><br></div><div> ParameterMap parameters;</div><div><br></div><div> std::string name;</div><div>};</div><div><br></div><div>class Module</div>
<div>{</div><div> public:</div><div> typedef std::unordered_map< std::string, PTXKernel > KernelMap;</div><div><br></div><div> private:</div><div> KernelMap _kernels;</div><div><br></div><div> public:</div>
<div> void insertKernel( const PTXKernel& kernel );</div><div>};</div><div><br></div><div>///////////////////////////////////////////////////////////////////////////////</div><div>/</div><div><br></div><div>Parameter::Parameter()</div>
<div>{</div><div> offset = 0;</div><div> argument = false;</div><div>}</div><div><br></div><div>Parameter::~Parameter() { }</div><div><br></div><div>Parameter::Parameter( bool arg ) : argument(arg)</div><div>{</div><div>
offset = 0;</div><div>}</div><div><br></div><div>/////////////////////////////</div><div><br></div><div>PTXKernel::PTXKernel( const std::string& n ) : name(n)</div><div>{</div><div> parameters.insert(make_pair(name,Parameter()));</div>
<div>}</div><div><br></div><div>PTXKernel::PTXKernel( const PTXKernel& kernel )</div><div>{</div><div> name = <a href="http://kernel.name">kernel.name</a>;</div><div> parameters = kernel.parameters;</div><div>
}</div><div><br></div><div>PTXKernel::~PTXKernel() { }</div><div><br></div><div>/////////////////////////////</div><div><br></div><div>void Module::insertKernel( const PTXKernel& kernel )</div><div>{</div><div> _kernels.insert( std::make_pair(<a href="http://kernel.name">kernel.name</a>,kernel) );</div>
<div>}</div><div><br></div><div>/////////////////////////////</div><div><br></div><div>int main()</div><div>{</div><div> PTXKernel k1( "k1" );</div><div> PTXKernel k2( "k2" );</div><div><br></div><div>
Module m;</div><div><br></div><div> m.insertKernel( k1 );</div><div> m.insertKernel( k2 );</div><div><br></div><div> return 0;</div><div>}</div></div><meta http-equiv="content-type" content="text/html; charset=utf-8">