|
template<typename Container_type > |
void | delete_container_pointers (Container_type &container) |
| Clears a container, but deletes all objects that the elements point to first. More...
|
|
template<typename Container_type > |
void | my_free_container_pointers (Container_type &container) |
| Clears a container, but frees all objects that the elements point to first. More...
|
|
template<typename T > |
T | pointer_cast (void *p) |
| Casts from one pointer type, to another, without using reinterpret_cast or C-style cast: foo f; bar *b= pointer_cast<bar>(f); This avoids having to do: foo f; bar *b= static_cast<bar>(static_cast<void*>(f));. More...
|
|
template<typename T > |
const T | pointer_cast (const void *p) |
|
template<typename Target , typename Source > |
Target | down_cast (Source *arg) |
| Casts from one pointer type to another in a type hierarchy. More...
|
|
template<typename Target , typename Source > |
Target | down_cast (Source &arg) |
| Casts from one reference type to another in a type hierarchy. More...
|
|
template<typename To > |
To | implicit_cast (To x) |
| Sometimes the compiler insists that types be the same and does not do any implicit conversion. More...
|
|
template<class T , size_t N> |
constexpr size_t | array_elements (T(&)[N]) noexcept |
| Number of elements in a constant C array. More...
|
|
template<class InputIt , class Pred , class Action > |
void | myu::Split (InputIt first, InputIt last, Pred &&pred, Action &&action) |
| Split a range into sub ranges delimited by elements satisfying a predicate. More...
|
|
template<class InputIt , class Pred > |
InputIt | myu::FindTrimmedEnd (InputIt first, InputIt last, Pred &&pred) |
| Search backwards for the first occurrence of an element which does not satisfy the trimming predicate, and return an InputIt to the element after it. More...
|
|
template<class InputIt , class Pred > |
std::pair< InputIt, InputIt > | myu::FindTrimmedRange (InputIt first, InputIt last, Pred &&pred) |
| Searches for a sub range such that no elements before or after fail to satisfy the trimming predicate. More...
|
|
Sometimes the compiler insists that types be the same and does not do any implicit conversion.
For example: Derived1 *a; Derived2 *b; // Derived1 and 2 are children classes of Base Base *x= cond ? a : b; // Error, need to force a cast.
Use: Base x= cond ? implicit_cast<Base>(a) : implicit_cast<Base*>(b); static_cast would work too, but would be less safe (allows any pointer-to-pointer conversion, not only up-casts).