libbmb
Modern implementation of STL
Loading...
Searching...
No Matches
bmb Namespace Reference

Namespaces

namespace  detail
 
namespace  llist
 

Classes

class  AllocatorTraits
 Unifined interface for allocators. More...
 
struct  bidirectional_iter_tag
 bidirectional_iter_tag More...
 
struct  compare_three_way
 compare_three_way More...
 
struct  conditional
 conditional More...
 
struct  conditional< false, IfTrue, IfFalse >
 
struct  conjunction
 Logical AND metafunction. More...
 
struct  contiguous_iter_tag
 contiguous_iter_tag More...
 
struct  disjunction
 Logical OR metafunction. More...
 
struct  enable_if
 enable_if More...
 
struct  enable_if< true, T >
 
struct  equal_to
 equal_to More...
 
struct  forward_iter_tag
 forward_iter_tag More...
 
struct  greater
 greater More...
 
struct  greater_equal
 greater_equal More...
 
struct  input_iter_tag
 input_iter_tag More...
 
struct  integral_constant
 integral_constant More...
 
struct  invoke_result
 invoke_result More...
 
struct  is_base_of
 is_base_of More...
 
struct  is_class
 is_class More...
 
struct  is_const
 is_const More...
 
struct  is_const< const T >
 
struct  is_invocable
 is_invocable More...
 
struct  is_lvalue_ref
 is_lvalue_ref More...
 
struct  is_lvalue_ref< T & >
 
struct  is_pointer
 is_pointer More...
 
struct  is_pointer< T * >
 
struct  is_rvalue_ref
 is_lvalue_ref More...
 
struct  is_rvalue_ref< T && >
 
struct  is_same
 is_same More...
 
struct  is_same< T, T >
 
struct  IteratorTraits
 IteratorTraits. More...
 
struct  IteratorTraits< T * >
 
struct  less
 less More...
 
struct  less_equal
 less_equal More...
 
class  LinkedList
 Singly linked list. More...
 
struct  not_equal_to
 not_equal_to More...
 
struct  output_iter_tag
 output_iter_tag More...
 
class  PrimitiveAllocator
 Allocator-proxy for new/delete operators. More...
 
struct  random_access_iter_tag
 random_access_iter_tag More...
 
struct  remove_const
 remove_const More...
 
struct  remove_const< const T >
 
struct  remove_ref
 remove_ref More...
 
struct  remove_ref< T & >
 
struct  remove_ref< T && >
 
struct  type_identity
 type_identity More...
 
class  Vector
 AllocatorAware dynamic array structure. More...
 

Concepts

concept  SameAs
 SameAs.
 
concept  DefaultConstructible
 DefaultConstructible.
 
concept  ConstructibleFrom
 ConstructibleFrom.
 
concept  NothrowConstructibleFrom
 NothrowConstructibleFrom.
 
concept  MoveConstructible
 MoveConstructible.
 
concept  NothrowMoveConstructible
 NothrowMoveConstructible.
 
concept  MoveAssignable
 MoveAssignable.
 
concept  NothrowMoveAssignable
 NothrowMoveAssignable.
 
concept  CopyConstructible
 CopyConstructible.
 
concept  NothrowCopyConstructible
 NothrowCopyConstructible.
 
concept  CopyAssignable
 CopyAssignable.
 
concept  NothrowCopyAssignable
 NothrowCopyAssignable.
 
concept  ConvertibleTo
 ConvertibleTo.
 
concept  Invocable
 Invocable.
 
concept  Predicate
 Predicate.
 
concept  InputIterator
 InputIterator.
 
concept  OutputIterator
 OutputIterator.
 
concept  ForwardIterator
 ForwardIterator.
 
concept  BidirectionalIterator
 BidirectionalIterator.
 
concept  RandomAccessIterator
 RandomAccessIterator.
 
concept  ContiguousIterator
 ContiguousIterator.
 

Typedefs

template<typename T , bool TrackLast, typename Allocator = PrimitiveAllocator>
using LListFastSize = LinkedList< T, true, TrackLast, Allocator >
 LinkedList with enabled track of size.
 
template<typename T , bool TrackSize, typename Allocator = PrimitiveAllocator>
using LListFastLast = LinkedList< T, TrackSize, true, Allocator >
 LinkedList with enabled track of last element.
 
template<typename T , typename Allocator = PrimitiveAllocator>
using LListTiny = LinkedList< T, false, false, Allocator >
 LinkedList without size and last element tracking.
 
template<typename T , typename Allocator = PrimitiveAllocator>
using LListFat = LinkedList< T, true, true, Allocator >
 LinkedList with size and last element tracking.
 
template<typename T >
using type_identity_t = type_identity< T >::type
 type_identity_t
 
template<bool val>
using bool_constant = integral_constant< val >
 bool_constant
 
using true_type = bool_constant< true >
 true_type
 
using false_type = bool_constant< false >
 false_type
 
template<typename T >
using remove_const_t = remove_const< T >::type
 remove_const_t
 
template<typename T >
using remove_ref_t = remove_ref< T >::type
 remove_ref_t
 
template<bool Cond, typename IfTrue , typename IfFalse >
using conditional_t = conditional< Cond, IfTrue, IfFalse >::type
 conditional_t
 
template<bool Cond, typename T = void>
using enable_if_t = enable_if< Cond, T >::type
 enable_if_t
 
template<typename... >
using void_t = void
 
template<typename F , typename... Args>
using invoke_result_t = invoke_result< F, Args... >::type
 invoke_result_t
 

Functions

template<InputIterator Iter1, InputIterator Iter2, typename Cmp = compare_three_way>
auto lexicographical_compare_three_way (Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2, Cmp cmp=Cmp())
 Compares ranges lexicographically using C++20 three-way comparation.
 
template<InputIterator Iter1, InputIterator Iter2, typename Pred = equal_to>
requires Predicate<Pred, typename IteratorTraits<Iter1>::reference, typename IteratorTraits<Iter2>::reference>
bool equal (Iter1 first1, Iter1 last1, Iter2 first2, Pred pred=Pred())
 Checks whether given ranges are equal.
 
template<InputIterator Iter1, InputIterator Iter2, typename Pred = equal_to>
requires Predicate<Pred, typename IteratorTraits<Iter1>::reference, typename IteratorTraits<Iter2>::reference>
bool equal (Iter1 first1, Iter1 last1, Iter2 first2, Iter2 last2, Pred pred=Pred())
 Checks whether given ranges are equal.
 
template<typename T , bool TrackSize = true, bool TrackLast = true, typename Allocator = PrimitiveAllocator>
void swap (LinkedList< T, TrackSize, TrackLast, Allocator > &a, LinkedList< T, TrackSize, TrackLast, Allocator > &b)
 See LinkedList::swap
 
template<InputIterator Iter, typename Allocator = PrimitiveAllocator>
 LinkedList (Iter, Iter, Allocator=Allocator()) -> LinkedList< typename IteratorTraits< Iter >::value_type, true, true, PrimitiveAllocator >
 
template<InputIterator Iter, typename Allocator = PrimitiveAllocator>
 Vector (Iter, Iter, Allocator=Allocator()) -> Vector< typename IteratorTraits< Iter >::value_type, Allocator >
 
template<InputIterator Iter>
auto distance (Iter first, Iter last) -> IteratorTraits< Iter >::difference_type
 Returns the number of elements in [first, last).
 
template<InputIterator Iter, typename Distance >
void advance (Iter &it, Distance dist)
 Increments given iterator by dist.
 
template<InputIterator Iter>
Iter next (Iter it, typename IteratorTraits< Iter >::difference_type n=1)
 Returns the n-th successor of given iterator.
 
template<BidirectionalIterator Iter>
Iter prev (Iter it, typename IteratorTraits< Iter >::difference_type n=1)
 Returns the n-th predecessor of given iterator. If n < 0, will chose n-th successor.
 
template<typename T >
constexpr remove_ref_t< T > && move (T &&value) noexcept
 Convert a value to xvalue.
 
template<typename T >
constexpr T && forward (remove_ref_t< T > &value) noexcept
 Forward a lvalue.
 
template<typename T >
requires (!is_lvalue_ref_v<T>)
constexpr T && forward (remove_ref_t< T > &&value) noexcept
 Forward a rvalue.
 
template<typename T >
void swap (T &x, T &y)
 Swap values.
 
template<typename T >
T && declval ()
 declval
 

Variables

template<typename... Types>
constexpr bool conjunction_v = conjunction<Types...>::value
 Logical AND metafunction.
 
template<typename... Types>
constexpr bool disjunction_v = disjunction<Types...>::value
 Logical OR metafunction.
 
template<typename T , typename U >
constexpr bool is_same_v = is_same<T, U>::value
 is_same_v
 
template<typename T >
constexpr bool is_lvalue_ref_v = is_lvalue_ref<T>::value
 is_lvalue_ref_v
 
template<typename T >
constexpr bool is_rvalue_ref_v = is_rvalue_ref<T>::value
 is_rvalue_ref_v
 
template<typename T >
constexpr bool is_const_v = is_const<T>::value
 is_const_v
 
template<typename T >
constexpr bool is_class_v = is_class<T>::value
 is_class_v
 
template<typename T >
constexpr bool is_pointer_v = is_pointer<T>::value
 is_pointer_v
 
template<typename Base , typename Derived >
constexpr bool is_base_of_v = is_base_of<Base, Derived>::value
 is_base_of_v
 
template<typename F , typename... Args>
constexpr bool is_invocable_v = is_invocable<F, Args...>::value
 is_invocable_v
 

Typedef Documentation

◆ bool_constant

bool_constant

◆ conditional_t

◆ enable_if_t

template<bool Cond, typename T = void>
using bmb::enable_if_t = typedef enable_if<Cond, T>::type

enable_if_t

◆ false_type

◆ invoke_result_t

template<typename F , typename... Args>
using bmb::invoke_result_t = typedef invoke_result<F, Args...>::type

invoke_result_t

◆ LListFastLast

template<typename T , bool TrackSize, typename Allocator = PrimitiveAllocator>
using bmb::LListFastLast = typedef LinkedList<T, TrackSize, true, Allocator>

LinkedList with enabled track of last element.

◆ LListFastSize

template<typename T , bool TrackLast, typename Allocator = PrimitiveAllocator>
using bmb::LListFastSize = typedef LinkedList<T, true, TrackLast, Allocator>

LinkedList with enabled track of size.

◆ LListFat

LinkedList with size and last element tracking.

◆ LListTiny

LinkedList without size and last element tracking.

◆ remove_const_t

remove_const_t

◆ remove_ref_t

remove_ref_t

◆ true_type

◆ type_identity_t

type_identity_t

◆ void_t

template<typename... >
using bmb::void_t = typedef void

A metafunction that always equals to void, used for SFINAE checking(detecting valid types)

Example: template <typename T, typename = void_t> struct SomeStruct {};

template <typename T> struct SomeStruct<T, void_t<T::value_type>> {...};

Here the partial specialization is always chosen when T::value_type is valid, otherwise SFINAE works and first definition is chosen.

Function Documentation

◆ advance()

template<InputIterator Iter, typename Distance >
void bmb::advance ( Iter it,
Distance  dist 
)

Increments given iterator by dist.

If iterator is at least RandomAccessIterator - uses +=. If it BidirectionalIterator - uses either + or - dist times. If it at least InputIterator and dist > 0 - uses +, if dist < 0 - has no effect.

Time complexity: O(1) for RandomAccessIterator, otherwise O(dist)

Parameters
itIterator to be advanced
distNumber of elements iterator should be advanced
Exceptions
Almostalways nothrow. In general, the same as modifying iterator operations.

◆ declval()

template<typename T >
T && bmb::declval ( )

declval

◆ distance()

template<InputIterator Iter>
auto bmb::distance ( Iter  first,
Iter  last 
) -> IteratorTraits<Iter>::difference_type

Returns the number of elements in [first, last).

Time complexity: O(1) if Iter satisfies at least RandomAccessIterator, otherwise O(last - first).

Parameters
firstIterator to the first element
lastIterator to the end of the range
Returns
The number of increments needed to go from first to last
Exceptions
Almostalways nothrow. In general, the same as either operator-(It, It) or operator++()

◆ equal() [1/2]

template<InputIterator Iter1, InputIterator Iter2, typename Pred = equal_to>
requires Predicate<Pred, typename IteratorTraits<Iter1>::reference, typename IteratorTraits<Iter2>::reference>
bool bmb::equal ( Iter1  first1,
Iter1  last1,
Iter2  first2,
Iter2  last2,
Pred  pred = Pred() 
)

Checks whether given ranges are equal.

Given Predicate must return boolean-convertible value.

Time complexity: O(min(last1 - first1, last2 - first2))

Parameters
first1Start of the 1-st range
last1End of the 1-st range
first2Start of the 2-nd range
predPredicate that compares range elements
Returns
true if ranges are equal on Predicate. false otherwise.
Exceptions
Almostalways noexcept. In fact, the same specification as operations on iterators and calling predicate.

See equal overload for InputIterator constraints. In addition to it, this overload firstly checks length of the compared ranges to enable early inequality detection.

Time complexity: 1) If last1 - first1 != last2 - first2: O(1), 2) Otherwise: O(min(last1 - first1, last2 - first2))

◆ equal() [2/2]

template<InputIterator Iter1, InputIterator Iter2, typename Pred = equal_to>
requires Predicate<Pred, typename IteratorTraits<Iter1>::reference, typename IteratorTraits<Iter2>::reference>
bool bmb::equal ( Iter1  first1,
Iter1  last1,
Iter2  first2,
Pred  pred = Pred() 
)

Checks whether given ranges are equal.

More precisely, compares last1 - first1 elements from 2-nd range. Thus, 1-st range must not be longer than 2-nd one. Otherwise undefined behaviour - will increment the end iterator from 2-nd range. Given Predicate must return boolean-convertible value.

Time complexity: O(last1 - first1)

Parameters
first1Start of the 1-st range
last1End of the 1-st range
first2Start of the 2-nd range
predPredicate that compares range elements
Returns
true if ranges are equal on Predicate. false otherwise.
Exceptions
Almostalways noexcept. In fact, the same specification as operations on iterators and calling predicate.

◆ forward() [1/2]

template<typename T >
requires (!is_lvalue_ref_v<T>)
constexpr T && bmb::forward ( remove_ref_t< T > &&  value)
constexprnoexcept

Forward a rvalue.

Parameters
valueThe object to forward
Returns
Given value with proper expressions category

◆ forward() [2/2]

template<typename T >
constexpr T && bmb::forward ( remove_ref_t< T > &  value)
constexprnoexcept

Forward a lvalue.

Parameters
valueThe object to forward
Returns
Given value with proper expressions category

◆ lexicographical_compare_three_way()

template<InputIterator Iter1, InputIterator Iter2, typename Cmp = compare_three_way>
auto bmb::lexicographical_compare_three_way ( Iter1  first1,
Iter1  last1,
Iter2  first2,
Iter2  last2,
Cmp  cmp = Cmp() 
)

Compares ranges lexicographically using C++20 three-way comparation.

Compares elements iteratively, until either non-equal were found or some range was exausted. In the 2-nd case, detects longer range as greater.

Time complexity: O(min(last1 - first1, last2 - first2))

Parameters
first1- Start of the 1-st range
last1- End of the 1-st range
first2- Start of the 2-nd range
last2- End of the 2-nd range
cmp- Comparator that behaves as <=>. 'compare_three_way' is default one.
Returns
The relation of the ranges(like std::strong_ordering::less/greater/equal, etc.)
Exceptions
Almostalways noexcept. In fact, the same specification as iterators operations and call of comparator.

◆ LinkedList()

template<InputIterator Iter, typename Allocator = PrimitiveAllocator>
bmb::LinkedList ( Iter  ,
Iter  ,
Allocator  = Allocator() 
) -> LinkedList< typename IteratorTraits< Iter >::value_type, true, true, PrimitiveAllocator >

◆ move()

template<typename T >
constexpr remove_ref_t< T > && bmb::move ( T &&  value)
constexprnoexcept

Convert a value to xvalue.

Parameters
valueThe object to cast to xvalue
Returns
The given parameter casted to rvalue reference

◆ next()

template<InputIterator Iter>
Iter bmb::next ( Iter  it,
typename IteratorTraits< Iter >::difference_type  n = 1 
)

Returns the n-th successor of given iterator.

Parameters
itIterator
nNumber of elements to shift the iterator
Returns
Iterator that holds n-th successor of the given one
Exceptions
Sameas advance(Iter, diff_type)

◆ prev()

template<BidirectionalIterator Iter>
Iter bmb::prev ( Iter  it,
typename IteratorTraits< Iter >::difference_type  n = 1 
)

Returns the n-th predecessor of given iterator. If n < 0, will chose n-th successor.

Parameters
itIterator
nNumber of elements to shift the iterator
Returns
Iterator that holds n-th predecessor of the given one
Exceptions
Sameas advance(Iter, diff_type)

◆ swap() [1/2]

template<typename T , bool TrackSize = true, bool TrackLast = true, typename Allocator = PrimitiveAllocator>
void bmb::swap ( LinkedList< T, TrackSize, TrackLast, Allocator > &  a,
LinkedList< T, TrackSize, TrackLast, Allocator > &  b 
)

◆ swap() [2/2]

template<typename T >
void bmb::swap ( T x,
T y 
)

Swap values.

Parameters
xValue to swap
yValue to swap
Exceptions
Thesame exception safety as move c-tor and move assignmet operator of T

◆ Vector()

template<InputIterator Iter, typename Allocator = PrimitiveAllocator>
bmb::Vector ( Iter  ,
Iter  ,
Allocator  = Allocator() 
) -> Vector< typename IteratorTraits< Iter >::value_type, Allocator >

Variable Documentation

◆ conjunction_v

template<typename... Types>
constexpr bool bmb::conjunction_v = conjunction<Types...>::value
constexpr

Logical AND metafunction.

◆ disjunction_v

template<typename... Types>
constexpr bool bmb::disjunction_v = disjunction<Types...>::value
constexpr

Logical OR metafunction.

◆ is_base_of_v

template<typename Base , typename Derived >
constexpr bool bmb::is_base_of_v = is_base_of<Base, Derived>::value
constexpr

is_base_of_v

◆ is_class_v

template<typename T >
constexpr bool bmb::is_class_v = is_class<T>::value
constexpr

is_class_v

◆ is_const_v

template<typename T >
constexpr bool bmb::is_const_v = is_const<T>::value
constexpr

is_const_v

◆ is_invocable_v

template<typename F , typename... Args>
constexpr bool bmb::is_invocable_v = is_invocable<F, Args...>::value
constexpr

is_invocable_v

◆ is_lvalue_ref_v

template<typename T >
constexpr bool bmb::is_lvalue_ref_v = is_lvalue_ref<T>::value
constexpr

is_lvalue_ref_v

◆ is_pointer_v

template<typename T >
constexpr bool bmb::is_pointer_v = is_pointer<T>::value
constexpr

is_pointer_v

◆ is_rvalue_ref_v

template<typename T >
constexpr bool bmb::is_rvalue_ref_v = is_rvalue_ref<T>::value
constexpr

is_rvalue_ref_v

◆ is_same_v

template<typename T , typename U >
constexpr bool bmb::is_same_v = is_same<T, U>::value
constexpr

is_same_v