22 #ifndef __BINARYDATA_HPP__ 23 #define __BINARYDATA_HPP__ 25 #ifdef __cplusplus_cli 26 #pragma managed(push, off) 35 #include <boost/assert.hpp> 69 const T&
operator[](difference_type n)
const {
return *(current_ + n); }
103 T&
operator[](difference_type n)
const {
return *(current_ + n); }
124 #pragma region Ctors/Dtor 129 BinaryData(const_iterator first, const_iterator last);
138 #pragma region Iterators/accessors 163 return std::numeric_limits<int>().max() /
sizeof(T);
168 return const_iterator(*
this);
173 return iterator(*
this);
183 return const_iterator(*
this,
false);
186 const_iterator
end() const
193 return iterator(*
this,
false);
198 return reverse_iterator(end());
203 return const_reverse_iterator(cend());
213 return reverse_iterator(begin());
216 const_reverse_iterator
crend() const
218 return const_reverse_iterator(begin());
221 const_reverse_iterator
rend() const
228 BOOST_ASSERT(!empty());
234 BOOST_ASSERT(!empty());
240 BOOST_ASSERT(!empty());
246 BOOST_ASSERT(!empty());
250 const_reference operator[] (size_type index)
const;
252 reference operator[](size_type index);
254 const_reference
at(size_type index)
const 256 if (index < 0 || index >= size())
257 throw std::out_of_range(
"out of range");
258 return (*
this)[index];
261 reference
at(size_type index)
263 if (index < 0 || index >= size())
264 throw std::out_of_range(
"out of range");
265 return (*
this)[index];
269 #pragma region Mutators 287 void swap(std::vector<T> &that)
292 template <
typename Iter>
293 void assign(
const Iter& first,
const Iter& last)
296 insert(end(), first, last);
303 BOOST_ASSERT(i >= begin() && i <= end());
304 size_t Offset = i - begin();
306 return begin() + Offset;
310 void insert(iterator i, size_type n,
const T &
x)
312 BOOST_ASSERT(i >= begin() && i <= end());
313 size_t OldSize = size();
314 size_type offset = i - begin();
316 std::copy_backward(begin() + offset, begin() + OldSize, end());
317 std::fill(begin() + offset, begin() + offset + n, x);
321 template<
typename Iter>
322 void insert(iterator i,
const Iter& first,
const Iter& last)
324 BOOST_ASSERT(last >= first);
325 BOOST_ASSERT(i >= begin() && i <= end());
326 size_t count = last - first;
329 size_t offset = i - begin(), old_size = size();
330 resize(old_size + count);
331 for (iterator j = begin() + old_size,
k = end(); j != begin() + offset; )
332 std::iter_swap(--j, --
k);
333 std::copy(first, last, begin() + offset);
338 difference_type Offset = i - begin();
339 std::copy(i + 1, end(), i);
341 return begin() + Offset;
344 iterator
erase(iterator From, iterator To)
346 difference_type Offset = From - begin();
347 iterator i = std::copy(To, end(), From);
349 return begin() + Offset;
354 _resize(elements, FillWith);
379 void* managedStorage()
const;
382 operator const std::vector<T>&()
const;
389 #pragma warning(push) 390 #pragma warning(disable: 4251) 391 std::unique_ptr<Impl> _impl;
394 std::unique_ptr<Impl>
_impl;
397 void _alloc(size_type
elements,
const T & t);
400 void _resize(size_type
elements,
const T & FillWith);
402 void _swap(std::vector<T>& that);
404 void _assign(
const std::vector<T>& that);
405 size_type _size()
const;
406 size_type _capacity()
const;
418 #ifdef __cplusplus_cli 422 #endif //__BINARYDATA_HPP__
std::unique_ptr< Impl > _impl
iterator erase(iterator i)
void reserve(size_type n)
void push_back(const T &value)
difference_type operator-(const iterator &rhs) const
PWIZ_API_DECL Element * elements()
bool operator>(const const_iterator &that) const
iterator & operator+=(difference_type n)
bool operator<(const iterator &that) const
std::ptrdiff_t difference_type
reverse_iterator rbegin()
const T & const_reference
void insert(iterator i, size_type n, const T &x)
difference_type operator-(const const_iterator &rhs) const
bool operator>=(const iterator &that) const
const_reverse_iterator crbegin() const
bool operator!=(const iterator &that) const
void resize(size_type elements, const T &FillWith)
T & operator[](difference_type n) const
const_iterator cbegin() const
bool operator==(const const_iterator &that) const
std::reverse_iterator< const_iterator > const_reverse_iterator
BinaryData & operator=(const std::vector< T > &source)
void swap(pwiz::util::BinaryData< T > &lhs, std::vector< T > &rhs)
bool operator>(const iterator &that) const
const T * operator->() const
const_iterator(const const_iterator &rhs)
const_iterator operator-(difference_type n) const
const_reverse_iterator rend() const
bool operator==(const iterator &that) const
A custom vector class that can store its contents in either a std::vector or a cli::array (when compi...
const_iterator operator--(int)
void resize(size_type elements)
iterator(const iterator &rhs)
bool operator<=(const const_iterator &that) const
const_reverse_iterator crend() const
bool operator>=(const const_iterator &that) const
size_type max_size() const
const_iterator cend() const
iterator insert(iterator i, const T &x=T())
void swap(std::vector< T > &that)
bool operator<=(const iterator &that) const
void swap(BinaryData &that)
const_iterator operator+(difference_type n) const
const T & operator[](difference_type n) const
iterator operator-(difference_type n) const
const_iterator end() const
void assign(const Iter &first, const Iter &last)
const_iterator & operator++()
iterator erase(iterator From, iterator To)
iterator operator+(difference_type n) const
reference at(size_type index)
std::reverse_iterator< iterator > reverse_iterator
const_reference front() const
const_iterator operator++(int)
const T & operator*() const
const_iterator & operator+=(difference_type n)
KernelTraitsBase< Kernel >::space_type::abscissa_type x
bool operator!=(const const_iterator &that) const
PWIZ_API_DECL std::string value(const std::string &id, const std::string &name)
convenience function to extract a named value from an id string
const_iterator & operator--()
bool operator<(const const_iterator &that) const
iterator & operator-=(difference_type n)
const_reference at(size_type index) const
const_reference back() const
const_iterator & operator-=(difference_type n)
void insert(iterator i, const Iter &first, const Iter &last)
const_iterator begin() const
const_reverse_iterator rbegin() const
BinaryData & operator=(const BinaryData &that)