|
| shared_vector () |
| Empty vector (not very interesting)
|
|
| shared_vector (size_t c) |
| Allocate (with new[]) a new vector of size c.
|
|
| shared_vector (size_t c, param_type e) |
| Allocate (with new[]) a new vector of size c and fill with value e.
|
|
template<typename A > |
| shared_vector (A v, size_t o, size_t c) |
| Build vector from a raw pointer. More...
|
|
template<typename E1 > |
| shared_vector (const std::tr1::shared_ptr< E1 > &d, size_t o, size_t c) |
| Build vector from an existing smart pointer. More...
|
|
template<typename A , typename B > |
| shared_vector (A d, B b, size_t o, size_t c) |
| Build vector from raw pointer and cleanup function. More...
|
|
| shared_vector (const shared_vector &o) |
| Copy an existing vector of same type.
|
|
template<typename FROM > |
| shared_vector (const shared_vector< FROM > &src, detail::_shared_vector_cast_tag) |
|
| shared_vector (shared_vector< typename base_t::_E_non_const > &O, detail::_shared_vector_freeze_tag t) |
|
| shared_vector (shared_vector< const E > &O, detail::_shared_vector_thaw_tag t) |
|
shared_vector & | operator= (const shared_vector &o) |
|
size_t | max_size () const |
|
size_t | capacity () const |
|
void | reserve (size_t i) |
| Set array capacity. More...
|
|
void | resize (size_t i) |
| Grow or shrink array. More...
|
|
void | resize (size_t i, param_type v) |
| Grow (and fill) or shrink array. More...
|
|
void | make_unique () |
| Ensure (by copying) that this shared_vector is the sole owner of the data array. More...
|
|
iterator | begin () const |
|
const_iterator | cbegin () const |
|
iterator | end () const |
|
const_iterator | cend () const |
|
reverse_iterator | rbegin () const |
|
const_reverse_iterator | crbegin () const |
|
reverse_iterator | rend () const |
|
const_reverse_iterator | crend () const |
|
reference | front () const |
|
reference | back () const |
|
void | push_back (param_type v) |
|
void | pop_back () |
|
pointer | data () const |
| Return Base pointer.
|
|
reference | operator[] (size_t i) const |
| Member access Undefined if empty()==true.
|
|
reference | at (size_t i) const |
| Member access. More...
|
|
| shared_vector_base () |
| Empty vector (not very interesting)
|
|
template<typename A > |
| shared_vector_base (A *v, size_t o, size_t c) |
|
| shared_vector_base (const std::tr1::shared_ptr< E > &d, size_t o, size_t c) |
|
template<typename A , typename B > |
| shared_vector_base (A d, B b, size_t o, size_t c) |
|
| shared_vector_base (const shared_vector_base &O) |
|
| shared_vector_base (shared_vector_base< _E_non_const > &O, _shared_vector_freeze_tag) |
|
| shared_vector_base (shared_vector< const E > &O, _shared_vector_thaw_tag) |
|
shared_vector_base & | operator= (const shared_vector_base &o) |
| Copy an existing vector.
|
|
void | swap (shared_vector_base &o) |
| Swap the contents of this vector with another.
|
|
void | clear () |
| Clear contents. size() becomes 0.
|
|
bool | unique () const |
| Data is not shared?
|
|
size_t | size () const |
| Number of elements visible through this vector.
|
|
bool | empty () const |
| shorthand for size()==0
|
|
void | slice (size_t offset, size_t length=(size_t) -1) |
| Reduce the view of this shared_vector. More...
|
|
const std::tr1::shared_ptr< E > & | dataPtr () const |
|
size_t | dataOffset () const |
|
size_t | dataCount () const |
|
size_t | dataTotal () const |
|
template<typename E, class Enable>
class epics::pvData::shared_vector< E, Enable >
A holder for a contiguous piece of memory.
Data is shared, but offset and length are not. This allows one vector to have access to only a subset of a piece of memory.
The ways in which shared_vector is intended to differ from std::vector are outlined in Differences between std::vector and shared_vector .
Also see Memory Management with shared_vector and Value const-ness and shared_vector
- Warning
- Due to the implementation of std::tr1::shared_ptr, use of shared_vector should not be combined with use of weak_ptr. shared_ptr::unique() and shared_ptr::use_count() do not include weak_ptr instances. This breaks the assumption made by make_unique() that unique()==true implies exclusive ownership.
Definition at line 27 of file sharedVector.h.
template<typename E, class Enable>
Ensure (by copying) that this shared_vector is the sole owner of the data array.
If a copy is needed, memory is allocated with new[]. If this is not desirable then do something like the following.
shared_vector<E> original(...);
if(!original.unique()){
std::tr1::shared_ptr<E> sptr(myalloc(original.size()), myfree);
shared_vector<E> temp(sptr, 0, original.size());
std::copy(original.begin(), original.end(), temp.begin());
original.swap(temp);
}
assert(original.unique());
- Exceptions
-
std::bad_alloc | if requested allocation can not be made |
other | exceptions from element copy ctor |
Definition at line 526 of file sharedVector.h.