c++ - how do traits classes work? -
I'm reading Scott Meyer '' The symptom is talking about classes, I came to understand that the compilation time I need them to determine the type of object, but I did not understand what these classes really do. (Technically speaking)
For example, consider By using them, you can but for this to work, actually in an obvious definition somewhere This is the type of In the same vein, iterator_traits , which can be used for typefuffs (e.g.
value_type ).
iterator_traits & lt; Vector & lt; Int & gt; :: Iterator & gt; :: value_type x; Iterator_traits & lt; Int * & gt; :: value_type y; // `x` and 'y` are type int
& lt; Iterator & gt; is in the header, which reads something such as this:
template & lt; Typename T & gt; Straight iterator_traits & lt; T * & gt; {Type didif t value_type; // One ?? |};
iterator_traits for the types of partial specialization
T * , that is, some common types of Signal
iterator_traits are specific to other iterators, e.g.
typename vector & lt; T & gt; :: Iterator .
Comments
Post a Comment