mirror of
https://github.com/ETLCPP/etl.git
synced 2026-06-16 00:46:03 +08:00
Complete rewrite of aligned storage functionality and subsequent changes to the containers.
This commit is contained in:
parent
410109d72c
commit
6fea7b80bd
10
deque.h
10
deque.h
@ -80,7 +80,7 @@ namespace etl
|
||||
/// Default constructor.
|
||||
//*************************************************************************
|
||||
deque()
|
||||
: ideque<T>(reinterpret_cast<T*>(&buffer.value[0]), MAX_SIZE, BUFFER_SIZE)
|
||||
: ideque<T>(reinterpret_cast<T*>(&buffer[0]), MAX_SIZE, BUFFER_SIZE)
|
||||
{
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ namespace etl
|
||||
/// Copy constructor.
|
||||
//*************************************************************************
|
||||
deque(const deque& other)
|
||||
: ideque<T>(reinterpret_cast<T*>(&buffer.value[0]), MAX_SIZE, BUFFER_SIZE)
|
||||
: ideque<T>(reinterpret_cast<T*>(&buffer[0]), MAX_SIZE, BUFFER_SIZE)
|
||||
{
|
||||
ideque<T>::assign(other.begin(), other.end());
|
||||
}
|
||||
@ -98,7 +98,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
template <typename TIterator>
|
||||
deque(TIterator begin, TIterator end)
|
||||
: ideque<T>(reinterpret_cast<T*>(&buffer.value[0]), MAX_SIZE, BUFFER_SIZE)
|
||||
: ideque<T>(reinterpret_cast<T*>(&buffer[0]), MAX_SIZE, BUFFER_SIZE)
|
||||
{
|
||||
ideque<T>::assign(begin, end);
|
||||
}
|
||||
@ -107,7 +107,7 @@ namespace etl
|
||||
/// Assigns data to the deque.
|
||||
//*************************************************************************
|
||||
explicit deque(size_t n, typename ideque<T>::parameter_t value = value_type())
|
||||
: ideque<T>(reinterpret_cast<T*>(&buffer.value[0]), MAX_SIZE, BUFFER_SIZE)
|
||||
: ideque<T>(reinterpret_cast<T*>(&buffer[0]), MAX_SIZE, BUFFER_SIZE)
|
||||
{
|
||||
ideque<T>::assign(n, value);
|
||||
}
|
||||
@ -128,7 +128,7 @@ namespace etl
|
||||
private:
|
||||
|
||||
/// The unititialised buffer of T used in the deque.
|
||||
etl::align_as<array<uint8_t, BUFFER_SIZE * sizeof(T)>, T> buffer;
|
||||
typename etl::aligned_storage<sizeof(T), etl::alignment_of<T>::value>::type buffer[BUFFER_SIZE];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user