/usr/include/bobcat/iterator is in libbobcat-dev 3.23.01-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | #ifndef INCLUDED_BOBCAT_ITERATOR_
#define INCLUDED_BOBCAT_ITERATOR_
#include <iterator>
#include <limits>
#include <memory>
namespace FBB
{
template <typename Type>
class Iterator;
template <typename Type>
struct ReverseIterator: public std::reverse_iterator<Iterator<Type>>
{
explicit ReverseIterator(Type const &value);
explicit ReverseIterator(Iterator<Type> const &iter);
static ReverseIterator<Type> last(Type const &value);
};
template <typename Type>
bool operator==(Iterator<Type> const &lhs, Iterator<Type> const &rhs);
template <typename Type>
class Iterator: public std::iterator<std::input_iterator_tag, Type const>
{
friend bool operator==<>(Iterator<Type> const &lhs,
Iterator<Type> const &rhs);
Type d_value;
std::shared_ptr<Type> d_type;
public:
Iterator() = default;
explicit Iterator(Type const &value);
Iterator<Type> &operator++();
Iterator<Type> operator++(int);
Type const &operator*() const;
static Iterator<Type> last(Type value);
static Iterator<Type> min();
static Iterator<Type> max();
private:
friend struct std::reverse_iterator<Iterator<Type>>;
Iterator<Type> &operator--();
Iterator<Type> operator--(int);
};
template <typename Type>
inline Iterator<Type>::Iterator(Type const &value)
:
d_value(value),
d_type(new Type)
{}
template <typename Type>
inline Iterator<Type> Iterator<Type>::last(Type value)
{
return Iterator<Type>(++value);
}
template <typename Type>
inline Iterator<Type> Iterator<Type>::max()
{
return Iterator<Type>(std::numeric_limits<Type>::max());
}
template <typename Type>
inline Iterator<Type> Iterator<Type>::min()
{
return Iterator<Type>(std::numeric_limits<Type>::min());
}
template <typename Type>
inline Iterator<Type> &Iterator<Type>::operator--()
{
--d_value;
return *this;
}
template <typename Type>
inline bool operator==(Iterator<Type> const &lhs, Iterator<Type> const &rhs)
{
return lhs.d_value == rhs.d_value;
}
template <typename Type>
inline Iterator<Type> &Iterator<Type>::operator++()
{
++d_value;
return *this;
}
template <typename Type>
inline Iterator<Type> Iterator<Type>::operator--(int)
{
Iterator<Type> tmp(d_value--);
return tmp;
}
template <typename Type>
inline Iterator<Type> Iterator<Type>::operator++(int)
{
Iterator<Type> tmp(d_value++);
return tmp;
}
template <typename Type>
inline Type const &Iterator<Type>::operator*() const
{
return d_value;
//
// *d_type = d_value;
// return *d_type;
}
template <typename Type>
inline bool operator!=(Iterator<Type> const &lhs, Iterator<Type> const &rhs)
{
return not (lhs == rhs);
}
template <typename Type>
ReverseIterator<Type>::ReverseIterator(Type const &value)
:
std::reverse_iterator<Iterator<Type>>(Iterator<Type>(value))
{}
template <typename Type>
ReverseIterator<Type>::ReverseIterator(Iterator<Type> const &vi)
:
std::reverse_iterator<Iterator<Type>>(vi)
{}
template <typename Type>
inline ReverseIterator<Type> ReverseIterator<Type>::last(Type const &value)
{
return ReverseIterator<Type>(Iterator<Type>::last(value));
}
} // FBB
#endif
|