Slimelite BBS

stl help

Back to EMULATE

From Jerry Coffin · 1996-04-06 19:36 · #73565 in EMULATE

On (02 Apr 96) Mike Bilow wrote to Jerry Coffin...

 MB> Jerry Coffin wrote in a message to Chris Downs:

 CD>  I modified the STL headers according to the MS directions to add
 CD>  the std:: deal to numerous lines of the code.  And then I wrap
 CD>  the STL headers in the std namespace.  So don't I HAVE to use
 CD>  the std:: qualifier?

 JC> Perhaps it would be helpful to realize that according to the
 JC> C++ DWP: "All library entities shall be defined in the
 JC> namespace `std'" (17.3.1.1, verse 2) _Hopefully_ we won't
 JC> have to qualify all (or even most) use of the standard
 JC> library. :-|

 MB> That is a gross misapplication of the rule.  Uninstantiated templates
 MB> exist in the anonymous namespace, and instantiated templates are no
 MB> longer templates.

Here's a cut/paste from the public draft of the standard:

23-10 Containers library
DRAFT: 28 April 1995

23.2 Sequences

Header <stack> synopsis

namespace std {
    template <class Container> class stack;
    template <class Container> bool operator==(const stack<Container>&
        x, const stack<Container>& y);
    template <class Container> bool operator< (const stack<Container>&
        x, const stack<Container>& y);
}

Header <vector> synopsis

#include <memory> // for allocator

namespace std {
    template <class T, class Allocator = allocator> class vector;
    template <class T, class Allocator> bool operator==(const
        vector<T,Allocator>& x, const vector<T,Allocator>& y);
    template <class T, class Allocator> bool operator< (const
        vector<T,Allocator>& x, const vector<T,Allocator>& y);
    class vector<bool,allocator>; bool operator==(const
        vector<bool,allocator>& x, const vector<bool,allocator>& y);
    bool operator< (const vector<bool,allocator>& x, const
        vector<bool,allocator>& y);
}

I'll admit to being _far_ from an expert on namespaces, but that looks
to me like they intend for these to be in the `std' namespace.  Have I
missed something about how this is supposed to work?
    Later,
    Jerry.

... The Universe is a figment of its own imagination.

--- PPoint 1.90
 * Origin: Point Pointedly Pointless (1:128/77.3)