Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat kind of "Traits" are used/defined in the C++0x Standard
    primarykey
    data
    text
    <p>A trait in C++ encapsulates a family of operations that allow an Algorithm or Data Structure to operator with that type with which it is instantiated. <code>char_traits</code> are an example for grouping <code>string</code>- and file-required functions.</p> <p>But not all <em>traits</em> have "trait" in their name, right? <code>numeric_limits</code> comes to mind. Is this a "Trait", too? Even without the name "trait" in it?</p> <p><strong>So, are there other Templates that could/should be considered a "Trait"?</strong> Besides the examples I found:</p> <ul> <li><code>allocator_traits</code> how to get memory</li> <li><code>pointer_traits</code> how to access an object indirectly</li> <li><code>type_traits</code> meta programming</li> <li><code>char_taits</code> for sequence of symbols</li> <li><code>iterator_traits</code> how to get forward, backward and to the element</li> <li><code>regex_traits</code> for... regexes.</li> </ul> <p>I guess, what I am asking, too, is there a <em>pure definition</em> for traits?</p> <p>Some things I am especially unsure about are:</p> <ul> <li><code>numeric_limits</code> mentioned above</li> <li><code>&lt;chrono&gt;</code>s customization "traits", [20.11.4], i.e. <code>duration_values</code></li> <li>what about Hashing? Can the functor <code>hash&lt;&gt;</code> be considered to be a trait?</li> <li>If thats the case, are not all requirements "traits", like "CopyAssignable", etc?</li> <li>And then, are the abandoned "Concepts" the ultimate "trait"-Definition?</li> </ul> <p><strong>Update:</strong> The question what exactly makes a trait a trait seems a bit controversy in the details. Maybe a another question could be answered: <strong>Is there a comprehensive list which of the trait-like classes are new to C++0x, and which ones have already been in C++03?</strong> Maybe someone knows of a link to somewhere?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload