mirror of
https://github.com/ksherlock/mpw-shell.git
synced 2025-02-15 07:32:06 +00:00
improve mapped_file iterators
This commit is contained in:
parent
475bd392ad
commit
44b42e4fe4
@ -65,9 +65,13 @@ class mapped_file : public mapped_file_base {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef char *iterator;
|
typedef unsigned char value_type;
|
||||||
typedef const char *const_iterator;
|
|
||||||
|
|
||||||
|
typedef value_type *iterator;
|
||||||
|
typedef const value_type *const_iterator;
|
||||||
|
|
||||||
|
typedef value_type &reference ;
|
||||||
|
typedef const value_type &const_reference;
|
||||||
|
|
||||||
|
|
||||||
mapped_file() = default;
|
mapped_file() = default;
|
||||||
@ -87,25 +91,38 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *const_data() const {
|
const value_type *data() const {
|
||||||
return (const char *)_data;
|
return (const value_type *)_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
const_iterator const_begin() const {
|
value_type *data() {
|
||||||
return const_data();
|
return _flags == readonly ? (value_type *)nullptr : (value_type *)_data;
|
||||||
}
|
|
||||||
const_iterator const_end() const {
|
|
||||||
return const_data() + size();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *data() const {
|
const_iterator cbegin() const {
|
||||||
return _flags == readonly ? (char *)nullptr : (char *)_data;
|
return data();
|
||||||
}
|
}
|
||||||
iterator begin() const {
|
|
||||||
|
const_iterator cend() const {
|
||||||
|
return data() + size();
|
||||||
|
}
|
||||||
|
|
||||||
|
const_iterator begin() const {
|
||||||
|
return cbegin();
|
||||||
|
}
|
||||||
|
|
||||||
|
const_iterator end() const {
|
||||||
|
return cend();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
iterator begin() {
|
||||||
return _flags == readonly ? (iterator)nullptr : (iterator)_data;
|
return _flags == readonly ? (iterator)nullptr : (iterator)_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator end() const {
|
iterator end() {
|
||||||
return _flags == readonly ? (iterator)nullptr : (iterator)_data + size();
|
return _flags == readonly ? (iterator)nullptr : (iterator)_data + size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user