util/{Const,Writable}Buffer: drop more "_type" suffixes from type names

This commit is contained in:
Max Kellermann 2020-01-12 14:39:54 +01:00
parent 44d7a1d8d2
commit b11c5f8d30
7 changed files with 45 additions and 45 deletions

View File

@ -33,14 +33,14 @@ class CancellablePointer
: public boost::intrusive::list_base_hook<boost::intrusive::link_mode<boost::intrusive::normal_link>> {
public:
typedef T *pointer;
typedef T &reference_type;
typedef const T &const_reference_type;
typedef T &reference;
typedef const T &const_reference;
private:
pointer p;
public:
explicit CancellablePointer(reference_type _p):p(&_p) {}
explicit CancellablePointer(reference _p):p(&_p) {}
CancellablePointer(const CancellablePointer &) = delete;
@ -54,13 +54,13 @@ public:
p = nullptr;
}
reference_type Get() {
reference Get() {
assert(p != nullptr);
return *p;
}
constexpr bool Is(const_reference_type other) const {
constexpr bool Is(const_reference other) const {
return p == &other;
}
};
@ -68,8 +68,8 @@ public:
template<typename T, typename CT=CancellablePointer<T>>
class CancellableList {
public:
typedef typename CT::reference_type reference_type;
typedef typename CT::const_reference_type const_reference_type;
typedef typename CT::reference reference;
typedef typename CT::const_reference const_reference;
private:
typedef boost::intrusive::list<CT,
@ -79,10 +79,10 @@ private:
List list;
class MatchPointer {
const_reference_type p;
const_reference p;
public:
explicit constexpr MatchPointer(const_reference_type _p)
explicit constexpr MatchPointer(const_reference _p)
:p(_p) {}
constexpr bool operator()(const CT &a) const {
@ -91,12 +91,12 @@ private:
};
gcc_pure
iterator Find(reference_type p) noexcept {
iterator Find(reference p) noexcept {
return std::find_if(list.begin(), list.end(), MatchPointer(p));
}
gcc_pure
const_iterator Find(const_reference_type p) const noexcept {
const_iterator Find(const_reference p) const noexcept {
return std::find_if(list.begin(), list.end(), MatchPointer(p));
}
@ -123,12 +123,12 @@ public:
#endif
gcc_pure
bool Contains(const_reference_type p) const noexcept {
bool Contains(const_reference p) const noexcept {
return Find(p) != list.end();
}
template<typename... Args>
CT &Add(reference_type p, Args&&... args) {
CT &Add(reference p, Args&&... args) {
assert(Find(p) == list.end());
CT *c = new CT(p, std::forward<Args>(args)...);
@ -144,14 +144,14 @@ public:
delete &ct;
}
void Cancel(reference_type p) {
void Cancel(reference p) {
auto i = Find(p);
assert(i != list.end());
i->Cancel();
}
CT &Get(reference_type p) noexcept {
CT &Get(reference p) noexcept {
auto i = Find(p);
assert(i != list.end());

View File

@ -47,8 +47,8 @@ class AllocatedArray {
public:
typedef typename Buffer::size_type size_type;
typedef typename Buffer::reference_type reference_type;
typedef typename Buffer::const_reference_type const_reference_type;
typedef typename Buffer::reference reference;
typedef typename Buffer::const_reference const_reference;
typedef typename Buffer::iterator iterator;
typedef typename Buffer::const_iterator const_iterator;
@ -147,33 +147,33 @@ public:
return buffer.size;
}
reference_type front() noexcept {
reference front() noexcept {
return buffer.front();
}
const_reference_type front() const noexcept {
const_reference front() const noexcept {
return buffer.front();
}
reference_type back() noexcept {
reference back() noexcept {
return buffer.back();
}
const_reference_type back() const noexcept {
const_reference back() const noexcept {
return buffer.back();
}
/**
* Returns one element. No bounds checking.
*/
reference_type operator[](size_type i) noexcept {
reference operator[](size_type i) noexcept {
return buffer[i];
}
/**
* Returns one constant element. No bounds checking.
*/
const_reference_type operator[](size_type i) const noexcept {
const_reference operator[](size_type i) const noexcept {
return buffer[i];
}

View File

@ -44,8 +44,8 @@ template<typename T=char>
class AllocatedString {
public:
typedef typename StringPointer<T>::value_type value_type;
typedef typename StringPointer<T>::reference_type reference_type;
typedef typename StringPointer<T>::const_reference_type const_reference_type;
typedef typename StringPointer<T>::reference reference;
typedef typename StringPointer<T>::const_reference const_reference;
typedef typename StringPointer<T>::pointer pointer;
typedef typename StringPointer<T>::const_pointer const_pointer;
typedef std::size_t size_type;
@ -127,11 +127,11 @@ public:
return value;
}
reference_type operator[](size_type i) {
reference operator[](size_type i) {
return value[i];
}
const reference_type operator[](size_type i) const {
const reference operator[](size_type i) const {
return value[i];
}

View File

@ -93,8 +93,8 @@ template<typename T>
struct ConstBuffer {
typedef std::size_t size_type;
typedef T value_type;
typedef const T &reference_type;
typedef reference_type const_reference_type;
typedef const T &reference;
typedef reference const_reference;
typedef const T *pointer;
typedef pointer const_pointer;
typedef pointer iterator;
@ -198,7 +198,7 @@ struct ConstBuffer {
#ifdef NDEBUG
constexpr
#endif
reference_type operator[](size_type i) const noexcept {
reference operator[](size_type i) const noexcept {
#ifndef NDEBUG
assert(i < size);
#endif
@ -213,7 +213,7 @@ struct ConstBuffer {
#ifdef NDEBUG
constexpr
#endif
reference_type front() const noexcept {
reference front() const noexcept {
#ifndef NDEBUG
assert(!empty());
#endif
@ -227,7 +227,7 @@ struct ConstBuffer {
#ifdef NDEBUG
constexpr
#endif
reference_type back() const noexcept {
reference back() const noexcept {
#ifndef NDEBUG
assert(!empty());
#endif
@ -263,8 +263,8 @@ struct ConstBuffer {
* Remove the first element and return a reference to it.
* Buffer must not be empty.
*/
reference_type shift() noexcept {
reference_type result = front();
reference shift() noexcept {
reference result = front();
pop_front();
return result;
}

View File

@ -142,8 +142,8 @@ class HugeArray {
public:
typedef typename Buffer::size_type size_type;
typedef typename Buffer::value_type value_type;
typedef typename Buffer::reference_type reference;
typedef typename Buffer::const_reference_type const_reference;
typedef typename Buffer::reference reference;
typedef typename Buffer::const_reference const_reference;
typedef typename Buffer::iterator iterator;
typedef typename Buffer::const_iterator const_iterator;

View File

@ -37,8 +37,8 @@ template<typename T=char>
class StringPointer {
public:
typedef T value_type;
typedef T &reference_type;
typedef const T &const_reference_type;
typedef T &reference;
typedef const T &const_reference;
typedef T *pointer;
typedef const T *const_pointer;

View File

@ -92,8 +92,8 @@ template<typename T>
struct WritableBuffer {
typedef std::size_t size_type;
typedef T value_type;
typedef T &reference_type;
typedef const T &const_reference_type;
typedef T &reference;
typedef const T &const_reference;
typedef T *pointer;
typedef const T *const_pointer;
typedef pointer iterator;
@ -191,7 +191,7 @@ struct WritableBuffer {
#ifdef NDEBUG
constexpr
#endif
reference_type operator[](size_type i) const noexcept {
reference operator[](size_type i) const noexcept {
#ifndef NDEBUG
assert(i < size);
#endif
@ -206,7 +206,7 @@ struct WritableBuffer {
#ifdef NDEBUG
constexpr
#endif
reference_type front() const noexcept {
reference front() const noexcept {
#ifndef NDEBUG
assert(!empty());
#endif
@ -220,7 +220,7 @@ struct WritableBuffer {
#ifdef NDEBUG
constexpr
#endif
reference_type back() const noexcept {
reference back() const noexcept {
#ifndef NDEBUG
assert(!empty());
#endif
@ -252,8 +252,8 @@ struct WritableBuffer {
* Remove the first element and return a reference to it.
* Buffer must not be empty.
*/
reference_type shift() noexcept {
reference_type result = front();
reference shift() noexcept {
reference result = front();
pop_front();
return result;
}