forked from Alepha/Alepha
40 lines
853 B
C++
40 lines
853 B
C++
static_assert( __cplusplus > 2020'99 );
|
|
|
|
#pragma once
|
|
|
|
#include <Alepha/Alepha.h>
|
|
|
|
#include <functional>
|
|
|
|
#include <Alepha/Meta/Container/vector.h>
|
|
#include <Alepha/Meta/functional.h>
|
|
|
|
namespace Alepha::Hydrogen::Meta ::detail:: find_algo_m
|
|
{
|
|
inline namespace exports
|
|
{
|
|
template< typename Iter, typename Predicate >
|
|
constexpr bool
|
|
find_if( const Iter first, const Iter last, Predicate pred )
|
|
{
|
|
for( Iter pos= first; pos != last; ++pos )
|
|
{
|
|
if( pred( *pos ) ) return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
template< typename Iter, typename Value >
|
|
constexpr bool
|
|
find( const Iter first, const Iter last, const Value value )
|
|
{
|
|
return find_if( first, last, Meta::bind1st( std::equal_to{}, value ) );
|
|
}
|
|
}
|
|
}
|
|
|
|
namespace Alepha::Hydrogen::Meta::inline exports::inline find_algo_m
|
|
{
|
|
using namespace detail::find_algo_m::exports;
|
|
}
|