#include <qx/algo/contains.h>
#include <type_traits>
Go to the source code of this file.
|
| template<class container_t , class value_t > |
| bool | qx::add_unique (container_t &container, value_t &&value) |
| | Add an element to the container if it doesn't already contain one. More...
|
| |
| template<class container_t , class value_t , class predicate_t > |
| bool | qx::add_unique_if (container_t &container, value_t &&value, const predicate_t &predicate) |
| | Add an element to the container if all elements do not satisfy the predicate. More...
|
| |
- Author
- Khrapov
- Date
- 14.08.2022
- Copyright
- © Nick Khrapov, 2022. All right reserved.
Definition in file add.h.
◆ add_unique()
template<class container_t , class value_t >
| bool qx::add_unique |
( |
container_t & |
container, |
|
|
value_t && |
value |
|
) |
| |
Add an element to the container if it doesn't already contain one.
- Template Parameters
-
| container_t | - container type |
| value_t | - value type |
- Parameters
-
| container | - container to add to |
| value | - value to check and add |
- Return values
-
Definition at line 27 of file add.h.
◆ add_unique_if()
template<class container_t , class value_t , class predicate_t >
| bool qx::add_unique_if |
( |
container_t & |
container, |
|
|
value_t && |
value, |
|
|
const predicate_t & |
predicate |
|
) |
| |
Add an element to the container if all elements do not satisfy the predicate.
- Template Parameters
-
| container_t | - container type |
| value_t | - value type |
| predicate_t | - predicate type which can be called with (element, value) or (element) only |
- Parameters
-
| container | - container to add to |
| value | - value to check and add |
| predicate | - predicate object |
- Return values
-
Definition at line 51 of file add.h.