c++ - stl compliant container -


I'm curious to emphasize on an STL-compliant container (or promoter), I understand that Their either the same, or very similar) I have seen some examples that are called STL-compliant (for example, and clearly the actual STL containers), but I am not sure which component of those containers I want.

Whatever I can collect, at least these things are needed:

  1. STL-compliant artists (current STLs are only bi-directional Or use higher velletters, it is not known that it

  2. requires a mechanism (default for std) to define an allocation or It just happens - the opportunity is still going to be known that "STL-compliant Iterator" :: Allocation ), as well as co (Still trying to figure out what is the last part)

  3. Public typing for metaprogramming (indicator type, const indicator type) , Reference type, value type, const reference type, difference type, maybe some other?). Side Question: What is a difference type

  4. 'Generic' (i.e. using metaprogramming / templates) to enable the container to capture more than anything ) Do I miss something else, or worse, wrong in the above list (maybe some things like consultation, thread protection, exception generation / handling, e.t.c.)? Apart from this, is there any specialty doctor telling elsewhere what is necessary, if such a thing exists?

    1. Iterators: The standard library defines the iterator ranges from those categories If you want to supply iterators to a model, allow containers to istream_iterator and ostream_iterator stream, which do not provide a bidirectional interruptor, depending on your view.

    2. Basically, you allocate space for the n objects to use the allocation (n) of the allocator , And n objects were indicated by p to clear the space for deallocate (p, n) .

    3. Yes, you normally use the not algorithm build or deleted Do not do it. There are others (for example, associative containers define a key_type ). The inter_type is a type that can represent the difference between the two points, it is usually supplied by the allocation, so a container will have a typingfiffe such as:

    4. Not necessarily (or in general) included in any metaprogramming, just (quite basic) generic programming, that is, you define a template, but compile it Time does not consider any calculation as necessary (which should be happens metaprogramming).

      The current standard thread does not define anything about security The final reference for this is C ++ standard only. You can download the current C ++ 0x standard () current draft for free. Container requirements are in Section 23.2 You may also want to look at Josistis on the C ++ Standard Library - it is a little reader compared to the standard.

      Update: Threads were added, exactly, C +11 (only a little later after it was originally written), and some definitions on thread protection, data races, and so on. It broadly specifies what most people have already done: parallel reading is allowed, but writing should be specific.

Comments