1 #ifndef __COMPILE_TIME_BITS_HPP_INCLUDED__
2 #define __COMPILE_TIME_BITS_HPP_INCLUDED__
38 #include <type_traits>
54 #ifndef __cpp_lib_remove_cvref
57 typedef std::remove_cv_t<std::remove_reference_t<T>>
type;
64 #ifndef __cpp_lib_to_underlying
65 template<
class Enum >
68 return static_cast<std::underlying_type_t<Enum>
>(e);
75 #if defined(NCBI_COMPILER_ICC) || (defined(NCBI_COMPILER_MSVC) && NCBI_COMPILER_VERSION<=1916)
76 # define ct_const_tuple compile_time_bits::const_tuple
79 # define ct_const_tuple std::tuple
80 # define const_tuple std::tuple
83 #define ct_const_array std::array
84 #define const_array std::array
89 #ifndef __cpp_lib_hardware_interference_size
102 template <
typename T>
105 template <
typename T, std::
size_t N>
108 template <
typename T, std::
size_t N>
126 template<
typename T,
size_t N>
131 template<
typename T,
size_t N>
139 template <
typename T,
152 return to_array_impl(std::forward<T>(
a), std::make_index_sequence<N>{});
154 template <
typename T,
size_t N>
162 size_t N=
sizeof...(TArgs),
163 typename _Tuple=
typename std::enable_if<(
N>1),
164 std::tuple<TArgs...>>
::type,
165 typename T = std::tuple_element_t<0, _Tuple>
169 T _array[] = { std::forward<TArgs>(args)... };
177 template<
typename T,
typename _Unused=T>
186 using type = std::underlying_type_t<T>;
191 template<
class Enum>
199 template<
typename _BaseType,
typename _BackType=_BaseType>
207 template<
typename _BaseType>
209 std::is_enum<_BaseType>::value ||
210 std::numeric_limits<_BaseType>::is_integer,
221 template<
class _CharType,
typename tag=tagStrCase>
235 template<
typename,
typename =
void>
238 template<
typename _T>
249 template<
class _CharType>
267 std::is_same<T, ncbi::CTempString>::value ||
268 std::is_same<T, ncbi::CTempStringEx>::value,
273 template<
class _CharType>
276 template<
class _CharType,
class Traits,
class Allocator>
277 struct DeduceType<std::basic_string<_CharType, Traits, Allocator>>
281 template<
class _CharType,
class Traits>
286 template<
typename..._Types>
290 using init_type = std::pair<typename DeduceType<_Types>::init_type...>;
294 template<
typename..._Types>
303 template<
class _Self>
306 std::is_copy_constructible<typename _Self::init_type>::value &&
307 std::is_copy_constructible<typename _Self::value_type>::value,
319 template<
typename _Type>
383 template<
typename _Traits,
typename _AllowDuplicates>
386 template<
typename _Ty>
411 template<
typename _T1,
typename _T2>
443 template<
typename _T1,
typename _T2>
476 template<
typename _ProxyType>
480 template<
typename _SizeType,
typename _ArrayType>
489 : m_array { std::get<1>(
init) },
490 m_realsize { std::get<0>(
init) }
500 std::size_t m_realsize{0};
503 template<
typename _SizeType,
typename _ArrayType,
typename _IndexType>
509 using tuple_type = std::tuple<_SizeType, _ArrayType, _IndexType>;
516 : m_index { std::get<2>(
init) },
517 m_array { std::get<1>(
init) },
518 m_realsize { std::get<0>(
init) }
526 _IndexType m_index{};
527 _ArrayType m_array{};
528 _SizeType m_realsize{0};
531 template<
typename _ArrayType>
552 template<
typename _IndexType,
typename _ValueType>
561 template<
typename _ArrayType>
576 template<
typename _Traits,
typename _Backend,
typename _Duplicates = tag_DuplicatesNo>
629 using key_compare =
typename _Traits::hashed_key_type::value_compare;
635 return key_compare{}(_Traits::get_key(l), _Traits::get_key(
r));
641 template<
typename _TL,
typename _TR>
644 return typename _Traits::hashed_key_type::hash_compare{}(_Traits::get_key(l), _Traits::get_key(
r));
664 std::pair<const_iterator, const_iterator>
670 return std::make_pair(
702 typename _NotUsed = std::enable_if_t<
704 std::is_constructible<
backend_type,
typename _Other::backend_type
713 template<
typename _ArrayType>
721 template<
typename _ArrayType>
735 template<
typename...TArgs>
738 return _container.
size();
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
static constexpr auto sort(_Init &&init) noexcept
static constexpr bool can_index
std::reverse_iterator< const_iterator > const_reverse_iterator
typename _Traits::init_key_type init_key_type
const value_type * const_iterator
constexpr bool empty() const noexcept
typename _Traits::value_type value_type
typename _Traits::hashed_key_type::value_compare key_compare
const value_type & reference
constexpr const_reverse_iterator rcend() const noexcept
const_iterator lower_bound(intermediate _key) const
constexpr size_type capacity() const noexcept
std::pair< const_iterator, const_iterator > equal_range(intermediate _key) const
constexpr const_iterator begin() const noexcept
static constexpr bool is_presorted
static constexpr auto make_backend(const _ArrayType &init)
constexpr size_type size() const noexcept
constexpr const_reverse_iterator rbegin() const noexcept
typename _Traits::init_type init_type
typename _Traits::key_type intermediate
constexpr const_iterator end() const noexcept
constexpr const_iterator cbegin() const noexcept
const value_type * pointer
std::reverse_iterator< iterator > reverse_iterator
constexpr const_iterator cend() const noexcept
const_iterator upper_bound(intermediate _key) const
static constexpr bool can_index
constexpr const_reverse_iterator rend() const noexcept
const auto & get_backend() const noexcept
constexpr const_set_map_base(const _Other &_other)
constexpr size_type max_size() const noexcept
std::conditional_t< std::is_void< void >::value, portable_backend< index_type, value_type >, void > backend_type
constexpr const_reverse_iterator rcbegin() const noexcept
typename _Traits::hash_type hash_type
std::ptrdiff_t difference_type
const value_type * const_pointer
size_t get_alignment() const
static constexpr auto presorted(const _ArrayType &init)
const_iterator find(intermediate _key) const
std::conditional_t< can_index, hash_type, typename _Traits::value_type > index_type
const value_type & const_reference
constexpr const_set_map_base()=default
constexpr const_set_map_base(const backend_type &backend)
const value_type * iterator
constexpr size_type size() const noexcept
constexpr const_iterator begin() const noexcept
constexpr size_type max_size() const noexcept
const value_type * const_pointer
constexpr const_vector(value_type const (&init)[N])
const value_type & const_reference
constexpr const_reverse_iterator rbegin() const noexcept
std::reverse_iterator< const_iterator > const_reverse_iterator
const value_type * pointer
typename _THits2::value_type value_type
std::ptrdiff_t difference_type
constexpr const_iterator cend() const noexcept
constexpr const_reverse_iterator rcbegin() const noexcept
constexpr const_reference front() const
constexpr bool empty() const noexcept
constexpr size_type capacity() const noexcept
const_pointer const_iterator
constexpr const_reference at(size_t index) const
constexpr const_vector(const_pointer data, size_t size)
constexpr const_reverse_iterator rcend() const noexcept
constexpr const_reverse_iterator rend() const noexcept
constexpr const_vector(std::nullptr_t)
constexpr const_pointer data() const noexcept
constexpr const_iterator cbegin() const noexcept
constexpr const_vector(const std::array< value_type, N > &data)
constexpr const_iterator end() const noexcept
constexpr const_reference operator[](size_t index) const
constexpr const_reference back() const
const value_type & reference
constexpr const_vector()=default
std::reverse_iterator< iterator > reverse_iterator
const_vector< index_type > m_index
constexpr auto get_index() const noexcept
constexpr auto get_values() const noexcept
constexpr size_t realsize() const noexcept
const_vector< value_type > m_values
constexpr portable_backend()=default
constexpr portable_backend(const simple_backend< _ArrayType > &_Other)
typename _ArrayType::value_type value_type
constexpr auto get_index() const noexcept
constexpr presorted_backend(const _ArrayType &_Other)
typename _ArrayType::value_type index_type
constexpr size_t realsize() const noexcept
constexpr presorted_backend()=default
constexpr auto get_values() const noexcept
constexpr auto get_index() const noexcept
constexpr auto get_values() const noexcept
constexpr auto realsize() const noexcept
constexpr simple_backend()=default
constexpr auto indexsize() const noexcept
constexpr simple_backend(const std::pair< _SizeType, _ArrayType > &init)
typename _ArrayType::value_type index_type
constexpr auto realsize() const noexcept
constexpr simple_backend(const tuple_type &init)
constexpr auto indexsize() const noexcept
typename _IndexType::value_type index_type
typename _ArrayType::value_type value_type
std::tuple< _SizeType, _ArrayType, _IndexType > tuple_type
constexpr auto get_index() const noexcept
constexpr auto get_values() const noexcept
constexpr simple_backend()=default
constexpr size_t hardware_destructive_interference_size
constexpr std::underlying_type_t< Enum > to_underlying(Enum e) noexcept
typename remove_cvref< T >::type remove_cvref_t
constexpr size_t hardware_constructive_interference_size
static void DLIST_NAME() init(DLIST_LIST_TYPE *list)
typename real_underlying_type< T >::type real_underlying_type_t
constexpr real_underlying_type_t< Enum > to_real_underlying(Enum e) noexcept
constexpr auto to_array_impl(T &&a, std::index_sequence< I... >) -> std::array< _Elem, N >
std::integral_constant< ncbi::NStr::ECase, ncbi::NStr::eCase > tagStrCase
constexpr size_t get_array_size(T &&)
std::false_type tag_DuplicatesNo
typename array_elem< T >::type array_elem_t
constexpr auto make_array(T &&a)
std::true_type tag_DuplicatesYes
std::false_type tag_SortByValues
std::integral_constant< ncbi::NStr::ECase, ncbi::NStr::eNocase > tagStrNocase
std::true_type tag_SortByHashes
double value_type
The numeric datatype used by the parser.
const struct ncbi::grid::netcache::search::fields::KEY key
Magic spell ;-) needed for some weird compilers... very empiric.
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
std::less< hash_type > hash_compare
std::less< value_type > value_compare
std::pair< typename DeduceType< _Types >::init_type... > init_type
std::pair< typename DeduceType< _Types >::value_type... > value_type
std::tuple< typename DeduceType< _Types >::value_type... > value_type
std::tuple< typename DeduceType< _Types >::init_type... > init_type
ct_basic_string< _CharType > view
std::less< tagStrCase > value_compare
std::less< tagStrCase > hash_compare
constexpr bool operator()(const _TL &l, const _TR &r) const
constexpr bool operator()(const value_type &l, const value_type &r) const
typename straight_map_traits< _T1, _T2 >::init_type init_type
static constexpr const key_type & get_key(const key_type &v)
typename pair_type::value_type value_type
typename HT1::hash_type hash_type
static constexpr value_type construct(const init_type &v)
static constexpr hash_type get_init_hash(const init_type &v)
typename HT1::value_type key_type
typename HT1::init_type init_key_type
static constexpr const key_type & get_key(const value_type &v)
typename hashed_key_type::init_type init_type
static constexpr hash_type get_init_hash(const init_type &v)
typename hashed_key_type::init_type init_key_type
static constexpr const key_type & get_key(const value_type &v)
typename hashed_key_type::hash_type hash_type
typename hashed_key_type::value_type key_type
static constexpr value_type construct(const init_type &v)
typename hashed_key_type::value_type value_type
static constexpr const key_type & get_key(const value_type &v)
typename HT1::hash_type hash_type
typename HT1::value_type key_type
static constexpr value_type construct(const init_type &v)
static constexpr hash_type get_init_hash(const init_type &v)
static constexpr const key_type & get_key(const key_type &v)
typename pair_type::init_type init_type
typename HT1::init_type init_key_type
typename pair_type::value_type value_type
std::remove_cv_t< std::remove_reference_t< T > > type