micro-test-plus 6.0.0
µTest++ Testing Framework
Loading...
Searching...
No Matches
micro_os_plus::micro_test_plus::detail::array_operand< T > Struct Template Reference

An array operand of a comparator, other than a character array. More...

#include "micro-os-plus/micro-test-plus.h"

Public Member Functions

constexpr array_operand (const T *first, std::size_t count) noexcept
 Constructs the operand from the first element and the size of an array.
constexpr const T * begin (void) const noexcept
 Returns an iterator to the first element.
constexpr const T * end (void) const noexcept
 Returns an iterator past the last element.

Private Attributes

std::size_t count_
 The number of elements.
const T * first_
 The first element.

Detailed Description

template<class T>
struct micro_os_plus::micro_test_plus::detail::array_operand< T >

The comparators convert the arrays of any element type except the character types (the byte buffers and the arrays of numbers) to this type (see as_operand()), so that they are compared element by element, and written as ranges, instead of being compared and written as the addresses they decay to. Two arrays of different sizes are never equal, and the elements are compared with equal_to::apply(), so integers of different signedness are compared by value.

The elements are not copied; the operand must outlive the comparison, which is always the case within a check.

Template Parameters
TThe element type, possibly const.

Definition at line 1845 of file detail.h.

Constructor & Destructor Documentation

◆ array_operand()

template<class T>
micro_os_plus::micro_test_plus::detail::array_operand< T >::array_operand ( const T * first,
std::size_t count )
constexprnoexcept
Parameters
firstThe first element of the array.
countThe number of elements of the array.

Stores the pointer and the count; nothing is copied.

Definition at line 1627 of file detail-inlines.h.

1630 : first_{ first }, count_{ count }
1631 {
An array operand of a comparator, other than a character array.
Definition detail.h:1846
std::size_t count_
The number of elements.
Definition detail.h:1891

References first_.

Member Function Documentation

◆ begin()

template<class T>
const T * micro_os_plus::micro_test_plus::detail::array_operand< T >::begin ( void ) const
nodiscardconstexprnoexcept
Parameters
None.
Returns
A pointer to the first element.

Returns the stored pointer.

Definition at line 1639 of file detail-inlines.h.

1641 {
1642 return first_;

References first_.

Referenced by micro_os_plus::micro_test_plus::detail::operator<=>(), and micro_os_plus::micro_test_plus::detail::operator==().

◆ end()

template<class T>
const T * micro_os_plus::micro_test_plus::detail::array_operand< T >::end ( void ) const
nodiscardconstexprnoexcept
Parameters
None.
Returns
A pointer past the last element.

Returns the pointer past the last element.

Definition at line 1658 of file detail-inlines.h.

1660 {
1661 return first_ + count_;

References count_, and first_.

Referenced by micro_os_plus::micro_test_plus::detail::operator<=>(), and micro_os_plus::micro_test_plus::detail::operator==().

Member Data Documentation

◆ count_

template<class T>
std::size_t micro_os_plus::micro_test_plus::detail::array_operand< T >::count_
private

The extent of the array passed to the comparator.

Definition at line 1891 of file detail.h.

Referenced by end().

◆ first_

template<class T>
const T* micro_os_plus::micro_test_plus::detail::array_operand< T >::first_
private

Not owned; points into the array passed to the comparator.

Definition at line 1883 of file detail.h.

Referenced by array_operand(), begin(), and end().


The documentation for this struct was generated from the following files: