30#ifndef G2O_CERES_PUBLIC_INTERNAL_FIXED_ARRAY_H_
31#define G2O_CERES_PUBLIC_INTERNAL_FIXED_ARRAY_H_
57 typename std::conditional<std::is_trivial<T>::value, std::allocator<T>,
58 Eigen::aligned_allocator<T>>::type;
86 static_assert(!std::is_array<T>::value || std::extent<T>::value > 0,
87 "Arrays with unknown bounds cannot be used with FixedArray.");
94 template <
typename Iterator>
96 typename std::iterator_traits<Iterator>::iterator_category,
97 std::forward_iterator_tag>::value>::type;
99 return !std::is_trivially_default_constructible<StorageElement>::value;
105 using pointer =
typename AllocatorTraits::pointer;
127 std::make_move_iterator(other.
end()), a) {}
153 template <
typename Iterator, EnableIfForwardIterator<Iterator>* =
nullptr>
182 return (std::numeric_limits<difference_type>::max)() /
sizeof(
value_type);
307 return !(lhs == rhs);
311 return std::lexicographical_compare(lhs.
begin(), lhs.
end(), rhs.
begin(),
348 template <
typename OuterT,
349 typename InnerT =
typename std::remove_extent<OuterT>::type,
350 size_t InnerN = std::extent<OuterT>::value>
356 typename std::conditional<std::is_array<value_type>::value,
362 return std::addressof(ptr->
array);
411 InlinedStorage::AnnotateDestruct(
size());
429 InlinedStorage::AnnotateConstruct(
size());
430 return InlinedStorage::data();
433 AllocatorTraits::allocate(
alloc(),
size()));
445template <
typename T,
size_t N,
typename A>
448template <
typename T,
size_t N,
typename A>
void AnnotateDestruct(size_type)
void AnnotateConstruct(size_type)
char buff_[sizeof(StorageElement[inline_elements])]
void AnnotateConstruct(size_type)
void AnnotateDestruct(size_type)
std::tuple< size_type, allocator_type > size_alloc_
Storage(size_type n, const allocator_type &a)
StorageElement * InitializeData()
StorageElement * end() const
static bool UsingInlinedStorage(size_type n)
StorageElement * begin() const
constexpr size_type max_size() const
typename std::conditional< inline_elements==0, EmptyInlinedStorage, NonEmptyInlinedStorage >::type InlinedStorage
FixedArray(std::initializer_list< value_type > init_list, const allocator_type &a=allocator_type())
const_reverse_iterator crend() const
const value_type & const_reference
typename AllocatorTraits::const_pointer const_pointer
void operator=(FixedArray &&)=delete
static constexpr size_type inline_elements
typename AllocatorTraits::difference_type difference_type
static pointer AsValueType(pointer ptr)
const_iterator begin() const
static pointer AsValueType(StorageElementWrapper< value_type > *ptr)
reference operator[](size_type i)
static constexpr bool DefaultConstructorIsNonTrivial()
FixedArray(size_type n, const allocator_type &a=allocator_type())
const_reference operator[](size_type i) const
std::allocator_traits< A > AllocatorTraits
const_reverse_iterator rend() const
friend bool operator!=(const FixedArray &lhs, const FixedArray &rhs)
const_iterator cend() const
FixedArray(const FixedArray &other, const allocator_type &a=allocator_type())
typename AllocatorTraits::value_type value_type
friend bool operator<(const FixedArray &lhs, const FixedArray &rhs)
static constexpr size_t kInlineBytesDefault
FixedArray(size_type n, const value_type &val, const allocator_type &a=allocator_type())
typename std::enable_if< std::is_convertible< typename std::iterator_traits< Iterator >::iterator_category, std::forward_iterator_tag >::value >::type EnableIfForwardIterator
typename AllocatorTraits::size_type size_type
const_iterator cbegin() const
typename std::conditional< std::is_array< value_type >::value, StorageElementWrapper< value_type >, value_type >::type StorageElement
void operator=(const FixedArray &)=delete
const_pointer const_iterator
const_reference back() const
friend bool operator==(const FixedArray &lhs, const FixedArray &rhs)
const_reverse_iterator rbegin() const
const_pointer data() const
typename AllocatorTraits::allocator_type allocator_type
const_reference front() const
const_iterator end() const
const_reverse_iterator crbegin() const
void fill(const value_type &val)
reverse_iterator rbegin()
friend bool operator<=(const FixedArray &lhs, const FixedArray &rhs)
friend bool operator>=(const FixedArray &lhs, const FixedArray &rhs)
FixedArray(Iterator first, Iterator last, const allocator_type &a=allocator_type())
friend bool operator>(const FixedArray &lhs, const FixedArray &rhs)
std::reverse_iterator< iterator > reverse_iterator
std::reverse_iterator< const_iterator > const_reverse_iterator
FixedArray(FixedArray &&other, const allocator_type &a=allocator_type()) noexcept
typename AllocatorTraits::pointer pointer
void CopyRange(Allocator &alloc, Iterator destination, InputIterator first, InputIterator last)
void ConstructRange(Allocator &alloc, Iterator first, Iterator last, const Args &... args)
static constexpr auto kFixedArrayUseDefault
typename std::conditional< std::is_trivial< T >::value, std::allocator< T >, Eigen::aligned_allocator< T > >::type FixedArrayDefaultAllocator