merged from trunk

[SVN r21801]
This commit is contained in:
Dave Abrahams
2004-01-18 16:21:14 +00:00
parent ccb711f7e4
commit 1dbbc54e4b

View File

@@ -52,11 +52,12 @@ namespace boost {
// is really quite innocent. The name of this class needs to be // is really quite innocent. The name of this class needs to be
// changed. // changed.
template <class T> template <class T>
class static_object { class static_object
{
public: public:
static T& get() { static T& get()
static char d[sizeof(T)]; {
return *reinterpret_cast<T*>(d); return *reinterpret_cast<T*>(0);
} }
}; };
@@ -406,15 +407,35 @@ namespace boost {
template <class T> template <class T>
class input_iterator_archetype class input_iterator_archetype
{ {
public: private:
typedef input_iterator_archetype self; typedef input_iterator_archetype self;
public:
typedef std::input_iterator_tag iterator_category;
typedef T value_type;
struct reference {
operator value_type() { return static_object<T>::get(); }
};
typedef const T* pointer;
typedef std::ptrdiff_t difference_type;
self& operator=(const self&) { return *this; }
bool operator==(const self&) const { return true; }
bool operator!=(const self&) const { return true; }
reference operator*() const { return reference(); }
self& operator++() { return *this; }
self operator++(int) { return *this; }
};
template <class T>
class input_iterator_archetype_no_proxy
{
private:
typedef input_iterator_archetype_no_proxy self;
public: public:
typedef std::input_iterator_tag iterator_category; typedef std::input_iterator_tag iterator_category;
typedef T value_type; typedef T value_type;
typedef const T& reference; typedef const T& reference;
typedef const T* pointer; typedef const T* pointer;
typedef std::ptrdiff_t difference_type; typedef std::ptrdiff_t difference_type;
input_iterator_archetype() { }
self& operator=(const self&) { return *this; } self& operator=(const self&) { return *this; }
bool operator==(const self&) const { return true; } bool operator==(const self&) const { return true; }
bool operator!=(const self&) const { return true; } bool operator!=(const self&) const { return true; }
@@ -451,6 +472,30 @@ namespace boost {
output_iterator_archetype() { } output_iterator_archetype() { }
}; };
template <class T>
class input_output_iterator_archetype
{
private:
typedef input_output_iterator_archetype self;
struct in_out_tag : public std::input_iterator_tag, public std::output_iterator_tag { };
public:
typedef in_out_tag iterator_category;
typedef T value_type;
struct reference {
reference& operator=(const T&) { return *this; }
operator value_type() { return static_object<T>::get(); }
};
typedef const T* pointer;
typedef std::ptrdiff_t difference_type;
input_output_iterator_archetype() { }
self& operator=(const self&) { return *this; }
bool operator==(const self&) const { return true; }
bool operator!=(const self&) const { return true; }
reference operator*() const { return reference(); }
self& operator++() { return *this; }
self operator++(int) { return *this; }
};
template <class T> template <class T>
class forward_iterator_archetype class forward_iterator_archetype
{ {