forked from boostorg/concept_check
merged from trunk
[SVN r21801]
This commit is contained in:
@@ -52,12 +52,13 @@ 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);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class Base = null_archetype<> >
|
template <class Base = null_archetype<> >
|
||||||
@@ -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; }
|
||||||
@@ -423,7 +444,7 @@ namespace boost {
|
|||||||
self operator++(int) { return *this; }
|
self operator++(int) { return *this; }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
struct output_proxy {
|
struct output_proxy {
|
||||||
output_proxy& operator=(const T&) { return *this; }
|
output_proxy& operator=(const T&) { return *this; }
|
||||||
};
|
};
|
||||||
@@ -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
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user