Are the Standard Header available in source form?

  • Thread starter Steven T. Hatton
  • Start date
S

Steven T. Hatton

Are the Standard Headers as described in ISO/IEC 14882:2003 available in
source file form as they appear in the standard? What I mean by this is,
for example §20.4 describes the Header<memory> and contains segments of C++
code such as the following:

namespace std {
// 20.4.1, the default allocator:
template <class T> class allocator;
template <> class allocator<void>;
template <class T, class U>
bool operator==(const allocator<T>&, const allocator<U>&) throw();
template <class T, class U>
bool operator!=(const allocator<T>&, const allocator<U>&) throw();
// 20.4.2, raw storage iterator:
template <class OutputIterator, class T> class raw_storage_iterator;
// 20.4.3, temporary buffers:
template <class T>
pair<T*,ptrdiff_t> get_temporary_buffer(ptrdiff_t n);
template <class T>
void return_temporary_buffer(T* p);
// 20.4.4, specialized algorithms:
template <class InputIterator, class ForwardIterator>
ForwardIterator
uninitialized_copy(InputIterator first, InputIterator last,
ForwardIterator result);
template <class ForwardIterator, class T>
void uninitialized_fill(ForwardIterator first, ForwardIterator last,
const T& x);
template <class ForwardIterator, class Size, class T>
void uninitialized_fill_n(ForwardIterator first, Size n, const T& x);
// 20.4.5, pointers:
template<class X> class auto_ptr;
}


I can go through the entire document copying the contents of the 50 Headers
into text files. I have done just that for some of the headers. It seems
like a lot of unnecessary work if I can obtain these by downloading them.
The primary reason I want this is so I can build a tag database
representing the Standard Library.
 
P

Peter Koch Larsen

Steven T. Hatton said:
Are the Standard Headers as described in ISO/IEC 14882:2003 available in
source file form as they appear in the standard? What I mean by this is,
for example §20.4 describes the Header<memory> and contains segments of C++
code such as the following:

namespace std {
// 20.4.1, the default allocator:
template <class T> class allocator;
template <> class allocator<void>;
template <class T, class U>
bool operator==(const allocator<T>&, const allocator<U>&) throw();
template <class T, class U>
bool operator!=(const allocator<T>&, const allocator<U>&) throw();
// 20.4.2, raw storage iterator:
template <class OutputIterator, class T> class raw_storage_iterator;
// 20.4.3, temporary buffers:
template <class T>
pair<T*,ptrdiff_t> get_temporary_buffer(ptrdiff_t n);
template <class T>
void return_temporary_buffer(T* p);
// 20.4.4, specialized algorithms:
template <class InputIterator, class ForwardIterator>
ForwardIterator
uninitialized_copy(InputIterator first, InputIterator last,
ForwardIterator result);
template <class ForwardIterator, class T>
void uninitialized_fill(ForwardIterator first, ForwardIterator last,
const T& x);
template <class ForwardIterator, class Size, class T>
void uninitialized_fill_n(ForwardIterator first, Size n, const T& x);
// 20.4.5, pointers:
template<class X> class auto_ptr;
}


I can go through the entire document copying the contents of the 50 Headers
into text files. I have done just that for some of the headers. It seems
like a lot of unnecessary work if I can obtain these by downloading them.
The primary reason I want this is so I can build a tag database
representing the Standard Library.
--
"[M]y dislike for the preprocessor is well known. Cpp is essential in C
programming, and still important in conventional C++ implementations, but
it is a hack, and so are most of the techniques that rely on it. ...I think
the time has come to be serious about macro-free C++ programming." - B. S.

This isn't guaranteed by the standard, but my bet is you'll find these
headers with your compiler distribution.

/Peter
 
S

Steven T. Hatton

Peter Koch Larsen wrote:

This isn't guaranteed by the standard, but my bet is you'll find these
headers with your compiler distribution.

/Peter

Much to my surprise that isn't quite as simple as it may seem. There are
header file representing the Standard Headers, but they are not very
similar to the files produced by simply copying the header declarations
from the Standard. This seems to be the case with both my GCC and
Microsoft compilers.
 
R

Richard Herring

Steven T. Hatton said:
Much to my surprise that isn't quite as simple as it may seem. There are
header file representing the Standard Headers, but they are not very
similar to the files produced by simply copying the header declarations
from the Standard. This seems to be the case with both my GCC and
Microsoft compilers.

Why is that surprising, given the number of times the words
*implementation defined* occur in the declarations in the Standard?
 
S

Steven T. Hatton

Richard said:
Why is that surprising, given the number of times the words
*implementation defined* occur in the declarations in the Standard?

Out of 50 headers that appears 36 times. Always in reference to iterators
except for the case in vector where it is in reference to pointer and
const_pointer. I only appears in typedef statements which could very
easily be modified by the implementer by replacing the words
"implementation defined" with the identifier for the implementations
definition.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top