mirror of
https://github.com/ETLCPP/etl.git
synced 2026-04-30 19:09:10 +08:00
Updates for Code::Blocks and CodeLite
Updates so that Code::Blocks and CodeLite can compile the tests. Made include guards upper case.
This commit is contained in:
parent
740b088282
commit
1108b9e5c7
4
array.h
4
array.h
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_array__
|
||||
#define __etl_array__
|
||||
#ifndef __ETL_ARRAY__
|
||||
#define __ETL_ARRAY__
|
||||
|
||||
#include <iterator>
|
||||
#include <functional>
|
||||
|
||||
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_container__
|
||||
#define __etl_container__
|
||||
#ifndef __ETL_CONTAINER__
|
||||
#define __ETL_CONTAINER__
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
4
crc16.h
4
crc16.h
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_crc16__
|
||||
#define __etl_crc16__
|
||||
#ifndef __ETL_CRC16__
|
||||
#define __ETL_CRC16__
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_crc16_ccitt__
|
||||
#define __etl_crc16_ccitt__
|
||||
#ifndef __ETL_CRC16_CCITT__
|
||||
#define __ETL_CRC16_CCITT__
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
4
crc32.h
4
crc32.h
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_crc32__
|
||||
#define __etl_crc32__
|
||||
#ifndef __ETL_CRC32__
|
||||
#define __ETL_CRC32__
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_crc64_ecma__
|
||||
#define __etl_crc64_ecma__
|
||||
#ifndef __ETL_CRC64_ECMA__
|
||||
#define __ETL_CRC64_ECMA__
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_crc8_ccitt__
|
||||
#define __etl_crc8_ccitt__
|
||||
#ifndef __ETL_CRC8_CCITT__
|
||||
#define __ETL_CRC8_CCITT__
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_cyclic_value__
|
||||
#define __etl_cyclic_value__
|
||||
#ifndef __ETL_CYCLIC_VALUE__
|
||||
#define __ETL_CYCLIC_VALUE__
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
4
deque.h
4
deque.h
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_deque__
|
||||
#define __etl_deque__
|
||||
#ifndef __ETL_DEQUE__
|
||||
#define __ETL_DEQUE__
|
||||
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
|
||||
@ -26,12 +26,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_in_ideque_h__
|
||||
#ifndef __ETL_IN_IDEQUE_H__
|
||||
#error This header is a private element of etl::deque & etl::ideque
|
||||
#endif
|
||||
|
||||
#ifndef __etl_deque_base__
|
||||
#define __etl_deque_base__
|
||||
#ifndef __ETL_DEQUE_BASE__
|
||||
#define __ETL_DEQUE_BASE__
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_enum_type__
|
||||
#define __etl_enum_type__
|
||||
#ifndef __ETL_ENUM_TYPE__
|
||||
#define __ETL_ENUM_TYPE__
|
||||
|
||||
///\defgroup enum_type enum_type
|
||||
/// Smart enumerations.<br>
|
||||
|
||||
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_exception__
|
||||
#define __etl_exception__
|
||||
#ifndef __ETL_EXCEPTION__
|
||||
#define __ETL_EXCEPTION__
|
||||
|
||||
///\defgroup exception exception
|
||||
/// The base class for all ETL exceptions.
|
||||
|
||||
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_function__
|
||||
#define __etl_function__
|
||||
#ifndef __ETL_FUNCTION__
|
||||
#define __ETL_FUNCTION__
|
||||
|
||||
//*****************************************************************************
|
||||
///\defgroup function function
|
||||
|
||||
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_functional__
|
||||
#define __etl_functional__
|
||||
#ifndef __ETL_FUNCTIONAL__
|
||||
#define __ETL_FUNCTIONAL__
|
||||
|
||||
///\defgroup functional functional
|
||||
///\ingroup Utilities
|
||||
|
||||
64
ideque.h
64
ideque.h
@ -26,9 +26,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_ideque__
|
||||
#define __etl_ideque__
|
||||
#define __etl_in_ideque_h__
|
||||
#ifndef __ETL_IDEQUE__
|
||||
#define __ETL_IDEQUE__
|
||||
#define __ETL_IN_IDEQUE_H__
|
||||
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
@ -77,6 +77,9 @@ namespace etl
|
||||
|
||||
//***************************************************
|
||||
iterator()
|
||||
: index(0),
|
||||
p_deque(0),
|
||||
p_buffer(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -106,7 +109,7 @@ namespace etl
|
||||
}
|
||||
|
||||
//***************************************************
|
||||
reference operator +=(difference_type offset)
|
||||
iterator operator +=(difference_type offset)
|
||||
{
|
||||
if (offset > 0)
|
||||
{
|
||||
@ -118,11 +121,11 @@ namespace etl
|
||||
operator -= (-offset);
|
||||
}
|
||||
|
||||
return p_buffer[index];
|
||||
return *this;
|
||||
}
|
||||
|
||||
//***************************************************
|
||||
reference operator -=(difference_type offset)
|
||||
iterator operator -=(difference_type offset)
|
||||
{
|
||||
if (offset > 0)
|
||||
{
|
||||
@ -134,7 +137,7 @@ namespace etl
|
||||
operator += (-offset);
|
||||
}
|
||||
|
||||
return p_buffer[index];
|
||||
return *this;
|
||||
}
|
||||
|
||||
//***************************************************
|
||||
@ -213,19 +216,19 @@ namespace etl
|
||||
}
|
||||
|
||||
//***************************************************
|
||||
inline difference_type get_index() const
|
||||
difference_type get_index() const
|
||||
{
|
||||
return index;
|
||||
}
|
||||
|
||||
//***************************************************
|
||||
inline ideque& get_deque() const
|
||||
ideque& get_deque() const
|
||||
{
|
||||
return *p_deque;
|
||||
}
|
||||
|
||||
//***************************************************
|
||||
inline pointer get_buffer() const
|
||||
pointer get_buffer() const
|
||||
{
|
||||
return p_buffer;
|
||||
}
|
||||
@ -260,6 +263,9 @@ namespace etl
|
||||
|
||||
//***************************************************
|
||||
const_iterator()
|
||||
: index(0),
|
||||
p_deque(0),
|
||||
p_buffer(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -297,7 +303,7 @@ namespace etl
|
||||
}
|
||||
|
||||
//***************************************************
|
||||
reference operator +=(difference_type offset)
|
||||
const_iterator operator +=(difference_type offset)
|
||||
{
|
||||
if (offset > 0)
|
||||
{
|
||||
@ -309,11 +315,11 @@ namespace etl
|
||||
operator -= (-offset);
|
||||
}
|
||||
|
||||
return p_buffer[index];
|
||||
return *this;
|
||||
}
|
||||
|
||||
//***************************************************
|
||||
reference operator -=(difference_type offset)
|
||||
const_iterator operator -=(difference_type offset)
|
||||
{
|
||||
if (offset > 0)
|
||||
{
|
||||
@ -325,7 +331,7 @@ namespace etl
|
||||
operator += (-offset);
|
||||
}
|
||||
|
||||
return p_buffer[index];
|
||||
return *this;
|
||||
}
|
||||
|
||||
//***************************************************
|
||||
@ -392,19 +398,19 @@ namespace etl
|
||||
}
|
||||
|
||||
//***************************************************
|
||||
inline difference_type get_index() const
|
||||
difference_type get_index() const
|
||||
{
|
||||
return index;
|
||||
}
|
||||
|
||||
//***************************************************
|
||||
inline ideque& get_deque() const
|
||||
ideque& get_deque() const
|
||||
{
|
||||
return *p_deque;
|
||||
}
|
||||
|
||||
//***************************************************
|
||||
inline pointer get_buffer() const
|
||||
pointer get_buffer() const
|
||||
{
|
||||
return p_buffer;
|
||||
}
|
||||
@ -459,7 +465,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Gets an iterator to the beginning of the deque.
|
||||
//*************************************************************************
|
||||
inline iterator begin()
|
||||
iterator begin()
|
||||
{
|
||||
return first;
|
||||
}
|
||||
@ -467,7 +473,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Gets an iterator to the end of the deque.
|
||||
//*************************************************************************
|
||||
inline iterator end()
|
||||
iterator end()
|
||||
{
|
||||
return ++iterator(last);
|
||||
}
|
||||
@ -475,7 +481,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Gets a const iterator to the beginning of the deque.
|
||||
//*************************************************************************
|
||||
inline const_iterator begin() const
|
||||
const_iterator begin() const
|
||||
{
|
||||
return first;
|
||||
}
|
||||
@ -483,7 +489,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Gets a const iterator to the end of the deque.
|
||||
//*************************************************************************
|
||||
inline const_iterator end() const
|
||||
const_iterator end() const
|
||||
{
|
||||
return ++iterator(last);
|
||||
}
|
||||
@ -491,7 +497,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Gets a const iterator to the beginning of the deque.
|
||||
//*************************************************************************
|
||||
inline const_iterator cbegin() const
|
||||
const_iterator cbegin() const
|
||||
{
|
||||
return first;
|
||||
}
|
||||
@ -499,7 +505,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Gets a const iterator to the end of the deque.
|
||||
//*************************************************************************
|
||||
inline const_iterator cend() const
|
||||
const_iterator cend() const
|
||||
{
|
||||
return ++const_iterator(last);
|
||||
}
|
||||
@ -507,7 +513,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Gets a reverse iterator to the end of the deque.
|
||||
//*************************************************************************
|
||||
inline reverse_iterator rbegin()
|
||||
reverse_iterator rbegin()
|
||||
{
|
||||
return reverse_iterator(end());
|
||||
}
|
||||
@ -515,7 +521,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Gets a reverse iterator to the beginning of the deque.
|
||||
//*************************************************************************
|
||||
inline reverse_iterator rend()
|
||||
reverse_iterator rend()
|
||||
{
|
||||
return reverse_iterator(begin());
|
||||
}
|
||||
@ -523,7 +529,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Gets a const reverse iterator to the end of the deque.
|
||||
//*************************************************************************
|
||||
inline const_reverse_iterator rbegin() const
|
||||
const_reverse_iterator rbegin() const
|
||||
{
|
||||
return const_reverse_iterator(end());
|
||||
}
|
||||
@ -531,7 +537,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Gets a const reverse iterator to the beginning of the deque.
|
||||
//*************************************************************************
|
||||
inline const_reverse_iterator rend() const
|
||||
const_reverse_iterator rend() const
|
||||
{
|
||||
return const_reverse_iterator(begin());
|
||||
}
|
||||
@ -539,7 +545,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Gets a const reverse iterator to the end of the deque.
|
||||
//*************************************************************************
|
||||
inline const_reverse_iterator crbegin() const
|
||||
const_reverse_iterator crbegin() const
|
||||
{
|
||||
return const_reverse_iterator(cend());
|
||||
}
|
||||
@ -547,7 +553,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
/// Gets a const reverse iterator to the beginning of the deque.
|
||||
//*************************************************************************
|
||||
inline const_reverse_iterator crend() const
|
||||
const_reverse_iterator crend() const
|
||||
{
|
||||
return const_reverse_iterator(cbegin());
|
||||
}
|
||||
|
||||
11
ilist.h
11
ilist.h
@ -26,9 +26,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_ilist__
|
||||
#define __etl_ilist__
|
||||
#define __etl_in_ilist_h__
|
||||
#ifndef __ETL_ILIST__
|
||||
#define __ETL_ILIST__
|
||||
#define __ETL_IN_ILIST_H__
|
||||
|
||||
#if WIN32
|
||||
#undef min
|
||||
@ -717,6 +717,11 @@ namespace etl
|
||||
else
|
||||
{
|
||||
throw list_full();
|
||||
return end();
|
||||
}
|
||||
#else
|
||||
{
|
||||
return end();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
10
iqueue.h
10
iqueue.h
@ -26,9 +26,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_iqueue__
|
||||
#define __etl_iqueue__
|
||||
#define __etl_in_iqueue_h__
|
||||
#ifndef __ETL_IQUEUE__
|
||||
#define __ETL_IQUEUE__
|
||||
#define __ETL_IN_IQUEUE_H__
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
@ -70,7 +70,7 @@ namespace etl
|
||||
if (!full())
|
||||
{
|
||||
buffer[in] = item;
|
||||
in = (in == (MAX_SIZE - 1)) ? 0 : ++in;
|
||||
in = (in == (MAX_SIZE - 1)) ? 0 : in + 1;
|
||||
++current_size;
|
||||
}
|
||||
#ifdef ETL_USE_EXCEPTIONS
|
||||
@ -95,7 +95,7 @@ namespace etl
|
||||
|
||||
if (!full())
|
||||
{
|
||||
in = (in == (MAX_SIZE - 1)) ? 0 : ++in;
|
||||
in = (in == (MAX_SIZE - 1)) ? 0 : in + 1;
|
||||
++current_size;
|
||||
}
|
||||
#ifdef ETL_USE_EXCEPTIONS
|
||||
|
||||
6
istack.h
6
istack.h
@ -26,9 +26,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_istack__
|
||||
#define __etl_istack__
|
||||
#define __etl_in_istack_h__
|
||||
#ifndef __ETL_ISTACK__
|
||||
#define __ETL_ISTACK__
|
||||
#define __ETL_IN_ISTACK_H__
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
72
ivector.h
72
ivector.h
@ -26,9 +26,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_ivector__
|
||||
#define __etl_ivector__
|
||||
#define __etl_in_ivector_h__
|
||||
#ifndef __ETL_IVECTOR__
|
||||
#define __ETL_IVECTOR__
|
||||
#define __ETL_IN_IVECTOR_H__
|
||||
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
@ -67,7 +67,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
iterator begin()
|
||||
{
|
||||
return &buffer[0];
|
||||
return &p_buffer[0];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
@ -76,7 +76,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
const_iterator begin() const
|
||||
{
|
||||
return &buffer[0];
|
||||
return &p_buffer[0];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
@ -85,7 +85,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
const_iterator cbegin() const
|
||||
{
|
||||
return &buffer[0];
|
||||
return &p_buffer[0];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
@ -121,7 +121,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
iterator end()
|
||||
{
|
||||
return &buffer[current_size];
|
||||
return &p_buffer[current_size];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
@ -130,7 +130,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
const_iterator end() const
|
||||
{
|
||||
return &buffer[current_size];
|
||||
return &p_buffer[current_size];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
@ -139,7 +139,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
const_iterator cend() const
|
||||
{
|
||||
return &buffer[current_size];
|
||||
return &p_buffer[current_size];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
@ -169,6 +169,24 @@ namespace etl
|
||||
return const_reverse_iterator(cbegin());
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a pointer to the beginning of the vector data.
|
||||
///\return A pointer to the beginning of the vector data.
|
||||
//*********************************************************************
|
||||
pointer data()
|
||||
{
|
||||
return p_buffer;
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Returns a const pointer to the beginning of the vector data.
|
||||
///\return A const pointer to the beginning of the vector data.
|
||||
//*********************************************************************
|
||||
const_pointer data() const
|
||||
{
|
||||
return p_buffer;
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
/// Resizes the vector.
|
||||
/// If ETL_USE_EXCEPTIONS is defined and the new size is larger than the
|
||||
@ -187,7 +205,7 @@ namespace etl
|
||||
|
||||
if (newSize > current_size)
|
||||
{
|
||||
std::fill(&buffer[current_size], &buffer[newSize], value);
|
||||
std::fill(&p_buffer[current_size], &p_buffer[newSize], value);
|
||||
}
|
||||
|
||||
current_size = newSize;
|
||||
@ -310,7 +328,6 @@ namespace etl
|
||||
}
|
||||
}
|
||||
|
||||
template <class TIterator>
|
||||
//*********************************************************************
|
||||
/// Inserts a range of values to the vector.
|
||||
/// If ETL_USE_EXCEPTIONS is defined, throws vector_full if the vector does not have enough free space.
|
||||
@ -318,13 +335,16 @@ namespace etl
|
||||
///\param first The first element to add.
|
||||
///\param last The last + 1 element to add.
|
||||
//*********************************************************************
|
||||
template <class TIterator>
|
||||
void insert(iterator position, TIterator first, TIterator last)
|
||||
{
|
||||
size_t count = std::distance(first, last);
|
||||
|
||||
if ((current_size + count) > MAX_SIZE)
|
||||
{
|
||||
#ifdef ETL_USE_EXCEPTIONS
|
||||
throw vector_full();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -341,15 +361,15 @@ namespace etl
|
||||
//*********************************************************************
|
||||
void push_back(const T& value)
|
||||
{
|
||||
if (current_size == MAX_SIZE)
|
||||
{
|
||||
if (current_size == MAX_SIZE)
|
||||
{
|
||||
#ifdef ETL_USE_EXCEPTIONS
|
||||
throw vector_full();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer[current_size++] = value;
|
||||
p_buffer[current_size++] = value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -418,7 +438,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
reference front()
|
||||
{
|
||||
return buffer[0];
|
||||
return p_buffer[0];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
@ -427,7 +447,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
const_reference front() const
|
||||
{
|
||||
return buffer[0];
|
||||
return p_buffer[0];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
@ -436,7 +456,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
reference back()
|
||||
{
|
||||
return buffer[current_size - 1];
|
||||
return p_buffer[current_size - 1];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
@ -445,7 +465,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
const_reference back() const
|
||||
{
|
||||
return buffer[current_size - 1];
|
||||
return p_buffer[current_size - 1];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
@ -463,7 +483,7 @@ namespace etl
|
||||
}
|
||||
#endif
|
||||
|
||||
return buffer[i];
|
||||
return p_buffer[i];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
@ -481,7 +501,7 @@ namespace etl
|
||||
}
|
||||
#endif
|
||||
|
||||
return buffer[i];
|
||||
return p_buffer[i];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
@ -491,7 +511,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
reference operator[](size_t i)
|
||||
{
|
||||
return buffer[i];
|
||||
return p_buffer[i];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
@ -501,7 +521,7 @@ namespace etl
|
||||
//*********************************************************************
|
||||
const_reference operator[](size_t i) const
|
||||
{
|
||||
return buffer[i];
|
||||
return p_buffer[i];
|
||||
}
|
||||
|
||||
//*********************************************************************
|
||||
@ -514,7 +534,7 @@ namespace etl
|
||||
{
|
||||
const size_t length = std::min(MAX_SIZE, other.size());
|
||||
|
||||
std::copy(other.begin(), other.begin() + length, buffer);
|
||||
std::copy(other.begin(), other.begin() + length, p_buffer);
|
||||
current_size = length;
|
||||
|
||||
return *this;
|
||||
@ -525,15 +545,15 @@ namespace etl
|
||||
//*********************************************************************
|
||||
/// Constructor.
|
||||
//*********************************************************************
|
||||
ivector(T* buffer, size_t MAX_SIZE)
|
||||
ivector(T* p_buffer, size_t MAX_SIZE)
|
||||
: vector_base(MAX_SIZE),
|
||||
buffer(buffer)
|
||||
p_buffer(p_buffer)
|
||||
{
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
T* buffer;
|
||||
T* p_buffer;
|
||||
};
|
||||
|
||||
//***************************************************************************
|
||||
|
||||
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_largest__
|
||||
#define __etl_largest__
|
||||
#ifndef __ETL_LARGEST__
|
||||
#define __ETL_LARGEST__
|
||||
|
||||
///\defgroup largest largest
|
||||
///\ingroup utilities
|
||||
|
||||
4
list.h
4
list.h
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_list__
|
||||
#define __etl_list__
|
||||
#ifndef __ETL_LIST__
|
||||
#define __ETL_LIST__
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
11
list_base.h
11
list_base.h
@ -26,12 +26,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_in_ilist_h__
|
||||
#ifndef __ETL_IN_ILIST_H__
|
||||
#error This header is a private element of etl::list & etl::ilist
|
||||
#endif
|
||||
|
||||
#ifndef __etl_list_base__
|
||||
#define __etl_list_base__
|
||||
#ifndef __ETL_LIST_BASE__
|
||||
#define __ETL_LIST_BASE__
|
||||
|
||||
#include <cstddef>
|
||||
#include "exception.h"
|
||||
@ -130,7 +130,10 @@ namespace etl
|
||||
/// The constructor that is called from derived classes.
|
||||
//*************************************************************************
|
||||
list_base(size_type max_size)
|
||||
: MAX_SIZE(max_size)
|
||||
: next_free(0),
|
||||
count(0),
|
||||
MAX_SIZE(max_size)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
4
log.h
4
log.h
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_log__
|
||||
#define __etl_log__
|
||||
#ifndef __ETL_LOG__
|
||||
#define __ETL_LOG__
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_nullptr__
|
||||
#define __etl_nullptr__
|
||||
#ifndef __ETL_NULLPTR__
|
||||
#define __ETL_NULLPTR__
|
||||
|
||||
///\defgroup nullptr nullptr
|
||||
/// A definition of nullptr for compilers that don't support it as standard.
|
||||
|
||||
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_numeric__
|
||||
#define __etl_numeric__
|
||||
#ifndef __ETL_NUMERIC__
|
||||
#define __ETL_NUMERIC__
|
||||
|
||||
///\defgroup numeric numeric
|
||||
///\ingroup utilities
|
||||
|
||||
84
observer.h
84
observer.h
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_observer__
|
||||
#define __etl_observer__
|
||||
#ifndef __ETL_OBSERVER__
|
||||
#define __ETL_OBSERVER__
|
||||
|
||||
//*****************************************************************************
|
||||
///\defgroup observer observer
|
||||
@ -201,14 +201,15 @@ namespace etl
|
||||
class observer
|
||||
{
|
||||
public:
|
||||
virtual void notification(T1) = 0;
|
||||
virtual void notification(T2) = 0;
|
||||
virtual void notification(T3) = 0;
|
||||
virtual void notification(T4) = 0;
|
||||
virtual void notification(T5) = 0;
|
||||
virtual void notification(T6) = 0;
|
||||
virtual void notification(T7) = 0;
|
||||
virtual void notification(T8) = 0;
|
||||
virtual ~observer() {}
|
||||
virtual void notification(T1) = 0;
|
||||
virtual void notification(T2) = 0;
|
||||
virtual void notification(T3) = 0;
|
||||
virtual void notification(T4) = 0;
|
||||
virtual void notification(T5) = 0;
|
||||
virtual void notification(T6) = 0;
|
||||
virtual void notification(T7) = 0;
|
||||
virtual void notification(T8) = 0;
|
||||
};
|
||||
|
||||
//*********************************************************************
|
||||
@ -226,13 +227,14 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void notification(T1) = 0;
|
||||
virtual void notification(T2) = 0;
|
||||
virtual void notification(T3) = 0;
|
||||
virtual void notification(T4) = 0;
|
||||
virtual void notification(T5) = 0;
|
||||
virtual void notification(T6) = 0;
|
||||
virtual void notification(T7) = 0;
|
||||
virtual ~observer() {}
|
||||
virtual void notification(T1) = 0;
|
||||
virtual void notification(T2) = 0;
|
||||
virtual void notification(T3) = 0;
|
||||
virtual void notification(T4) = 0;
|
||||
virtual void notification(T5) = 0;
|
||||
virtual void notification(T6) = 0;
|
||||
virtual void notification(T7) = 0;
|
||||
};
|
||||
|
||||
//*********************************************************************
|
||||
@ -249,12 +251,13 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void notification(T1) = 0;
|
||||
virtual void notification(T2) = 0;
|
||||
virtual void notification(T3) = 0;
|
||||
virtual void notification(T4) = 0;
|
||||
virtual void notification(T5) = 0;
|
||||
virtual void notification(T6) = 0;
|
||||
virtual ~observer() {}
|
||||
virtual void notification(T1) = 0;
|
||||
virtual void notification(T2) = 0;
|
||||
virtual void notification(T3) = 0;
|
||||
virtual void notification(T4) = 0;
|
||||
virtual void notification(T5) = 0;
|
||||
virtual void notification(T6) = 0;
|
||||
};
|
||||
|
||||
//*********************************************************************
|
||||
@ -270,11 +273,12 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void notification(T1) = 0;
|
||||
virtual void notification(T2) = 0;
|
||||
virtual void notification(T3) = 0;
|
||||
virtual void notification(T4) = 0;
|
||||
virtual void notification(T5) = 0;
|
||||
virtual ~observer() {}
|
||||
virtual void notification(T1) = 0;
|
||||
virtual void notification(T2) = 0;
|
||||
virtual void notification(T3) = 0;
|
||||
virtual void notification(T4) = 0;
|
||||
virtual void notification(T5) = 0;
|
||||
};
|
||||
|
||||
//*********************************************************************
|
||||
@ -289,10 +293,11 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void notification(T1) = 0;
|
||||
virtual void notification(T2) = 0;
|
||||
virtual void notification(T3) = 0;
|
||||
virtual void notification(T4) = 0;
|
||||
virtual ~observer() {}
|
||||
virtual void notification(T1) = 0;
|
||||
virtual void notification(T2) = 0;
|
||||
virtual void notification(T3) = 0;
|
||||
virtual void notification(T4) = 0;
|
||||
};
|
||||
|
||||
//*********************************************************************
|
||||
@ -306,9 +311,10 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void notification(T1) = 0;
|
||||
virtual void notification(T2) = 0;
|
||||
virtual void notification(T3) = 0;
|
||||
virtual ~observer() {}
|
||||
virtual void notification(T1) = 0;
|
||||
virtual void notification(T2) = 0;
|
||||
virtual void notification(T3) = 0;
|
||||
};
|
||||
|
||||
//*********************************************************************
|
||||
@ -321,8 +327,9 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void notification(T1) = 0;
|
||||
virtual void notification(T2) = 0;
|
||||
virtual ~observer() {}
|
||||
virtual void notification(T1) = 0;
|
||||
virtual void notification(T2) = 0;
|
||||
};
|
||||
|
||||
//*********************************************************************
|
||||
@ -334,7 +341,8 @@ namespace etl
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void notification(T1) = 0;
|
||||
virtual ~observer() {}
|
||||
virtual void notification(T1) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
4
pow.h
4
pow.h
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_pow__
|
||||
#define __etl_pow__
|
||||
#ifndef __ETL_POW__
|
||||
#define __ETL_POW__
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
4
queue.h
4
queue.h
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_queue__
|
||||
#define __etl_queue__
|
||||
#ifndef __ETL_QUEUE__
|
||||
#define __ETL_QUEUE__
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
@ -26,12 +26,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_in_iqueue_h__
|
||||
#ifndef __ETL_IN_IQUEUE_H__
|
||||
#error This header is a private element of etl::queue & etl::iqueue
|
||||
#endif
|
||||
|
||||
#ifndef __etl_queue_base__
|
||||
#define __etl_queue_base__
|
||||
#ifndef __ETL_QUEUE_BASE__
|
||||
#define __ETL_QUEUE_BASE__
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
@ -153,7 +153,7 @@ namespace etl
|
||||
{
|
||||
if (!empty())
|
||||
{
|
||||
out = (out == (MAX_SIZE - 1)) ? 0 : ++out;
|
||||
out = (out == (MAX_SIZE - 1)) ? 0 : out + 1;
|
||||
--current_size;
|
||||
}
|
||||
}
|
||||
|
||||
4
stack.h
4
stack.h
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_stack__
|
||||
#define __etl_stack__
|
||||
#ifndef __ETL_STACK__
|
||||
#define __ETL_STACK__
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
@ -26,12 +26,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_in_istack_h__
|
||||
#ifndef __ETL_IN_ISTACK_H__
|
||||
#error This header is a private element of etl::stack & etl::istack
|
||||
#endif
|
||||
|
||||
#ifndef __etl_stack_base__
|
||||
#define __etl_stack_base__
|
||||
#ifndef __ETL_STACK_BASE__
|
||||
#define __ETL_STACK_BASE__
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
@ -123,7 +123,7 @@ namespace etl
|
||||
//*************************************************************************
|
||||
void clear()
|
||||
{
|
||||
top_index = 0;
|
||||
top_index = 0;
|
||||
current_size = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -24,8 +24,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_static_assert__
|
||||
#define __etl_static_assert__
|
||||
#ifndef __ETL_STATIC_ASSERT__
|
||||
#define __ETL_STATIC_ASSERT__
|
||||
|
||||
#if (WIN32)
|
||||
#define STATIC_ASSERT(Condition, Message) static_assert(Condition, Message)
|
||||
|
||||
@ -31,6 +31,7 @@ SOFTWARE.
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
@ -191,4 +191,4 @@ namespace
|
||||
CHECK_THROW(value.set(2, 7, 4), etl::cyclic_value_illegal_range);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -816,7 +816,8 @@ namespace FixedDequeTest
|
||||
data.push_back(5);
|
||||
data.push_back(6);
|
||||
|
||||
Data::iterator i_next = data.erase(data.end() - 1);
|
||||
Data::iterator i_erase = data.end() - 1;
|
||||
Data::iterator i_next = data.erase(i_erase);
|
||||
|
||||
CHECK_EQUAL(Data::difference_type(expected.size()), std::distance(data.begin(), data.end()));
|
||||
CHECK(std::equal(expected.begin(), expected.end(), data.begin()));
|
||||
@ -839,7 +840,8 @@ namespace FixedDequeTest
|
||||
data.push_back(6);
|
||||
|
||||
// Erase near beginning.
|
||||
Data::iterator i_next = data.erase(data.begin() + 1);
|
||||
Data::iterator i_erase = data.begin() + 1;
|
||||
Data::iterator i_next = data.erase(i_erase);
|
||||
|
||||
CHECK_EQUAL(Data::difference_type(expected1.size()), std::distance(data.begin(), data.end()));
|
||||
CHECK(std::equal(expected1.begin(), expected1.end(), data.begin()));
|
||||
@ -1973,4 +1975,4 @@ namespace FixedDequeTest
|
||||
CHECK(testDeque1 != testDeque2);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,10 +63,6 @@ namespace
|
||||
struct S2 { char a; short b; char c; };
|
||||
struct S3 { int a; short b; char c; };
|
||||
|
||||
size_t a = sizeof(S1);
|
||||
size_t b = sizeof(S2);
|
||||
size_t c = sizeof(S3);
|
||||
|
||||
size = etl::largest<S1, S2, S3>::size;
|
||||
type = std::is_same<S3, etl::largest<S1, S2, S3>::type>::value;
|
||||
|
||||
|
||||
@ -280,7 +280,6 @@ namespace
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, AssignSizeValueExcess)
|
||||
{
|
||||
const size_t EXCESS_SIZE = SIZE + 1;
|
||||
const int VALUE = 1;
|
||||
|
||||
Data data;
|
||||
@ -569,7 +568,9 @@ namespace
|
||||
are_equal = std::equal(data.begin(), data.end(), compare_data.begin());
|
||||
|
||||
CHECK(are_equal);
|
||||
CHECK(i_data == data.begin());
|
||||
|
||||
are_equal = i_data == data.begin();
|
||||
CHECK(are_equal);
|
||||
|
||||
// Move to the last value and erase.
|
||||
i_compare_data = compare_data.begin();
|
||||
@ -583,7 +584,8 @@ namespace
|
||||
are_equal = std::equal(data.begin(), data.end(), compare_data.begin());
|
||||
|
||||
CHECK(are_equal);
|
||||
CHECK(i_data == data.end());
|
||||
are_equal = i_data == data.end();
|
||||
CHECK(are_equal);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
@ -732,4 +734,4 @@ namespace
|
||||
CHECK(are_equal);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ namespace
|
||||
queue.push(1);
|
||||
}
|
||||
|
||||
CHECK_THROW(queue.push(1), etl::queue_full);
|
||||
CHECK_THROW(queue.push(1), etl::queue_full);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
@ -298,4 +298,4 @@ namespace
|
||||
CHECK(pass);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -259,4 +259,4 @@ namespace
|
||||
CHECK(pass);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@ -394,50 +394,50 @@ namespace
|
||||
//*************************************************************************
|
||||
TEST(make_signed)
|
||||
{
|
||||
CHECK((std::is_same<etl::make_signed<char>::type, std::make_signed<char>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<signed char>::type, std::make_signed<signed char>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<unsigned char>::type, std::make_signed<unsigned char>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<wchar_t>::type, std::make_signed<wchar_t>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<short>::type, std::make_signed<short>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<signed short>::type, std::make_signed<signed short>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<unsigned short>::type, std::make_signed<unsigned short>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<int>::type, std::make_signed<int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<signed int>::type, std::make_signed<signed int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<unsigned int>::type, std::make_signed<unsigned int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<long>::type, std::make_signed<long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<signed long>::type, std::make_signed<signed long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<unsigned long>::type, std::make_signed<unsigned long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<long long>::type, std::make_signed<long long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<signed long long>::type, std::make_signed<signed long long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<char>::type, std::make_signed<char>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<signed char>::type, std::make_signed<signed char>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<unsigned char>::type, std::make_signed<unsigned char>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<wchar_t>::type, std::make_signed<wchar_t>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<short>::type, std::make_signed<short>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<signed short>::type, std::make_signed<signed short>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<unsigned short>::type, std::make_signed<unsigned short>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<int>::type, std::make_signed<int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<signed int>::type, std::make_signed<signed int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<unsigned int>::type, std::make_signed<unsigned int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<long>::type, std::make_signed<long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<signed long>::type, std::make_signed<signed long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<unsigned long>::type, std::make_signed<unsigned long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<long long>::type, std::make_signed<long long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<signed long long>::type, std::make_signed<signed long long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<unsigned long long>::type, std::make_signed<unsigned long long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<const int>::type, std::make_signed<const int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<volatile int>::type, std::make_signed<volatile int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<const int>::type, std::make_signed<const int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<const int>::type, std::make_signed<const int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<volatile int>::type, std::make_signed<volatile int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<const int>::type, std::make_signed<const int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_signed<const volatile int>::type, std::make_signed<const volatile int>::type>::value));
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST(make_unsigned)
|
||||
{
|
||||
CHECK((std::is_same<etl::make_unsigned<char>::type, std::make_unsigned<char>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<signed char>::type, std::make_unsigned<signed char>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<unsigned char>::type, std::make_unsigned<unsigned char>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<wchar_t>::type, std::make_unsigned<wchar_t>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<short>::type, std::make_unsigned<short>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<signed short>::type, std::make_unsigned<signed short>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<unsigned short>::type, std::make_unsigned<unsigned short>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<int>::type, std::make_unsigned<int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<signed int>::type, std::make_unsigned<signed int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<unsigned int>::type, std::make_unsigned<unsigned int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<long>::type, std::make_unsigned<long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<signed long>::type, std::make_unsigned<signed long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<unsigned long>::type, std::make_unsigned<unsigned long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<long long>::type, std::make_unsigned<long long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<signed long long>::type, std::make_unsigned<signed long long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<char>::type, std::make_unsigned<char>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<signed char>::type, std::make_unsigned<signed char>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<unsigned char>::type, std::make_unsigned<unsigned char>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<wchar_t>::type, std::make_unsigned<wchar_t>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<short>::type, std::make_unsigned<short>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<signed short>::type, std::make_unsigned<signed short>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<unsigned short>::type, std::make_unsigned<unsigned short>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<int>::type, std::make_unsigned<int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<signed int>::type, std::make_unsigned<signed int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<unsigned int>::type, std::make_unsigned<unsigned int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<long>::type, std::make_unsigned<long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<signed long>::type, std::make_unsigned<signed long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<unsigned long>::type, std::make_unsigned<unsigned long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<long long>::type, std::make_unsigned<long long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<signed long long>::type, std::make_unsigned<signed long long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<unsigned long long>::type, std::make_unsigned<unsigned long long>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<const int>::type, std::make_unsigned<const int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<volatile int>::type, std::make_unsigned<volatile int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<const int>::type, std::make_unsigned<const int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<const int>::type, std::make_unsigned<const int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<volatile int>::type, std::make_unsigned<volatile int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<const int>::type, std::make_unsigned<const int>::type>::value));
|
||||
CHECK((std::is_same<etl::make_unsigned<const volatile int>::type, std::make_unsigned<const volatile int>::type>::value));
|
||||
}
|
||||
|
||||
@ -483,19 +483,19 @@ namespace
|
||||
float c;
|
||||
};
|
||||
|
||||
CHECK_EQUAL(std::alignment_of<char>::value, etl::alignment_of<char>::value);
|
||||
CHECK_EQUAL(std::alignment_of<unsigned char>::value, etl::alignment_of<unsigned char>::value);
|
||||
CHECK_EQUAL(std::alignment_of<short>::value, etl::alignment_of<short>::value);
|
||||
CHECK_EQUAL(std::alignment_of<unsigned short>::value, etl::alignment_of<unsigned short>::value);
|
||||
CHECK_EQUAL(std::alignment_of<int>::value, etl::alignment_of<int>::value);
|
||||
CHECK_EQUAL(std::alignment_of<unsigned int>::value, etl::alignment_of<unsigned int>::value);
|
||||
CHECK_EQUAL(std::alignment_of<long>::value, etl::alignment_of<long>::value);
|
||||
CHECK_EQUAL(std::alignment_of<unsigned long>::value, etl::alignment_of<unsigned long>::value);
|
||||
CHECK_EQUAL(std::alignment_of<long long>::value, etl::alignment_of<long long>::value);
|
||||
CHECK_EQUAL(std::alignment_of<unsigned long long>::value, etl::alignment_of<unsigned long long>::value);
|
||||
CHECK_EQUAL(std::alignment_of<float>::value, etl::alignment_of<float>::value);
|
||||
CHECK_EQUAL(std::alignment_of<double>::value, etl::alignment_of<double>::value);
|
||||
CHECK_EQUAL(std::alignment_of<Test>::value, etl::alignment_of<Test>::value);
|
||||
CHECK(std::alignment_of<char>::value == etl::alignment_of<char>::value);
|
||||
CHECK(std::alignment_of<unsigned char>::value == etl::alignment_of<unsigned char>::value);
|
||||
CHECK(std::alignment_of<short>::value == etl::alignment_of<short>::value);
|
||||
CHECK(std::alignment_of<unsigned short>::value == etl::alignment_of<unsigned short>::value);
|
||||
CHECK(std::alignment_of<int>::value == etl::alignment_of<int>::value);
|
||||
CHECK(std::alignment_of<unsigned int>::value == etl::alignment_of<unsigned int>::value);
|
||||
CHECK(std::alignment_of<long>::value == etl::alignment_of<long>::value);
|
||||
CHECK(std::alignment_of<unsigned long>::value == etl::alignment_of<unsigned long>::value);
|
||||
CHECK(std::alignment_of<long long>::value == etl::alignment_of<long long>::value);
|
||||
CHECK(std::alignment_of<unsigned long long>::value == etl::alignment_of<unsigned long long>::value);
|
||||
CHECK(std::alignment_of<float>::value == etl::alignment_of<float>::value);
|
||||
CHECK(std::alignment_of<double>::value == etl::alignment_of<double>::value);
|
||||
CHECK(std::alignment_of<Test>::value == etl::alignment_of<Test>::value);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -179,6 +179,34 @@ namespace
|
||||
CHECK(isEqual);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, DataPointer)
|
||||
{
|
||||
TestData testData(initial_data.begin(), initial_data.end());
|
||||
|
||||
Data data(testData.begin(), testData.end());
|
||||
|
||||
bool isEqual = std::equal(data.data(),
|
||||
data.data() + data.size(),
|
||||
testData.begin());
|
||||
|
||||
CHECK(isEqual);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, DataConstPointer)
|
||||
{
|
||||
TestData testData(initial_data.begin(), initial_data.end());
|
||||
|
||||
const Data data(testData.begin(), testData.end());
|
||||
|
||||
bool isEqual = std::equal(data.data(),
|
||||
data.data() + data.size(),
|
||||
testData.begin());
|
||||
|
||||
CHECK(isEqual);
|
||||
}
|
||||
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, ResizeUp)
|
||||
{
|
||||
@ -235,7 +263,6 @@ namespace
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Indexing)
|
||||
{
|
||||
const size_t INITIAL_SIZE = 5;
|
||||
TestData testData(initial_data.begin(), initial_data.end());
|
||||
|
||||
Data data(testData.begin(), testData.end());
|
||||
@ -249,7 +276,6 @@ namespace
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, IndexingConst)
|
||||
{
|
||||
const size_t INITIAL_SIZE = 5;
|
||||
const TestData testData(initial_data.begin(), initial_data.end());
|
||||
|
||||
const Data data(testData.begin(), testData.end());
|
||||
@ -263,7 +289,6 @@ namespace
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, Clear)
|
||||
{
|
||||
const size_t INITIAL_SIZE = 5;
|
||||
TestData testData(initial_data.begin(), initial_data.end());
|
||||
|
||||
Data data(testData.begin(), testData.end());
|
||||
@ -275,7 +300,6 @@ namespace
|
||||
//*************************************************************************
|
||||
TEST_FIXTURE(SetupFixture, AssignRange)
|
||||
{
|
||||
const size_t INITIAL_SIZE = 5;
|
||||
TestData testData(initial_data.begin(), initial_data.end());
|
||||
|
||||
Data data;
|
||||
@ -326,7 +350,6 @@ namespace
|
||||
{
|
||||
const size_t INITIAL_SIZE = 5;
|
||||
const int INITIAL_VALUE = 1;
|
||||
const int INSERT_VALUE = 2;
|
||||
|
||||
TestData testData(INITIAL_SIZE, INITIAL_VALUE);
|
||||
Data data(INITIAL_SIZE, INITIAL_VALUE);
|
||||
@ -370,7 +393,6 @@ namespace
|
||||
{
|
||||
const size_t INITIAL_SIZE = SIZE;
|
||||
const int INITIAL_VALUE = 1;
|
||||
const int INSERT_VALUE = 2;
|
||||
|
||||
Data data(INITIAL_SIZE, INITIAL_VALUE);
|
||||
|
||||
@ -393,7 +415,6 @@ namespace
|
||||
const size_t INITIAL_SIZE = 5;
|
||||
const size_t INSERT_SIZE = 3;
|
||||
const int INITIAL_VALUE = 1;
|
||||
const int INSERT_VALUE = 2;
|
||||
|
||||
TestData testData;
|
||||
Data data;
|
||||
@ -443,7 +464,6 @@ namespace
|
||||
const size_t INITIAL_SIZE = SIZE;
|
||||
const size_t INSERT_SIZE = 4;
|
||||
const int INITIAL_VALUE = 1;
|
||||
const int INSERT_VALUE = 2;
|
||||
|
||||
Data data(INITIAL_SIZE, INITIAL_VALUE);
|
||||
|
||||
|
||||
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_type_traits__
|
||||
#define __etl_type_traits__
|
||||
#ifndef __ETL_TYPE_TRAITS__
|
||||
#define __ETL_TYPE_TRAITS__
|
||||
|
||||
#include <cstddef>
|
||||
#include "nullptr.h"
|
||||
@ -225,7 +225,9 @@ namespace etl
|
||||
template <typename T> struct make_signed { typedef T type; };
|
||||
template <> struct make_signed<char> { typedef signed char type; };
|
||||
template <> struct make_signed<unsigned char> { typedef signed char type; };
|
||||
#ifdef WIN32
|
||||
template <> struct make_signed<wchar_t> { typedef short type; };
|
||||
#endif
|
||||
template <> struct make_signed<unsigned short> { typedef short type; };
|
||||
template <> struct make_signed<unsigned int> { typedef int type; };
|
||||
template <> struct make_signed<unsigned long> { typedef long type; };
|
||||
@ -239,8 +241,10 @@ namespace etl
|
||||
template <typename T> struct make_unsigned { typedef T type; };
|
||||
template <> struct make_unsigned<char> { typedef unsigned char type; };
|
||||
template <> struct make_unsigned<signed char> { typedef unsigned char type; };
|
||||
template <> struct make_unsigned<wchar_t> { typedef unsigned short type; };
|
||||
template <> struct make_unsigned<short> { typedef unsigned short type; };
|
||||
#ifdef WIN32
|
||||
template <> struct make_unsigned<wchar_t> { typedef unsigned short type; };
|
||||
#endif
|
||||
template <> struct make_unsigned<int> { typedef unsigned int type; };
|
||||
template <> struct make_unsigned<long> { typedef unsigned long type; };
|
||||
template <> struct make_unsigned<long long> { typedef unsigned long long type; };
|
||||
@ -297,13 +301,11 @@ namespace etl
|
||||
/// These require compiler specific intrinsics.
|
||||
///\ingroup type_traits
|
||||
#ifdef _MSC_VER
|
||||
// alignment_of
|
||||
template <typename T> struct alignment_of : integral_constant <size_t, __alignof(T)> {};
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
// alignment_of
|
||||
template <typename T> struct alignment_of : integral_constant <size_t, __alignof__(T)> {};
|
||||
template <typename T> struct alignment_of : integral_constant <size_t, size_t(__alignof__(T))> {};
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
4
vector.h
4
vector.h
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_vector__
|
||||
#define __etl_vector__
|
||||
#ifndef __ETL_VECTOR__
|
||||
#define __ETL_VECTOR__
|
||||
|
||||
#include <cstddef>
|
||||
#include <iterator>
|
||||
|
||||
@ -26,12 +26,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_in_ivector_h__
|
||||
#ifndef __ETL_IN_IVECTOR_H__
|
||||
#error This header is a private element of etl::vector & etl::ivector
|
||||
#endif
|
||||
|
||||
#ifndef __etl_vector_base__
|
||||
#define __etl_vector_base__
|
||||
#ifndef __ETL_VECTOR_BASE__
|
||||
#define __ETL_VECTOR_BASE__
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
|
||||
@ -26,8 +26,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef __etl_visitor__
|
||||
#define __etl_visitor__
|
||||
#ifndef __ETL_VISITOR__
|
||||
#define __ETL_VISITOR__
|
||||
|
||||
//*****************************************************************************
|
||||
///\defgroup visitor visitor
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user