ELC in dev
ELC-lang
载入中...
搜索中...
未找到
elc::defs::base::range_n::bitmark_for_quick_unindex< T > 模板结构体 参考

bitmark提供了一种快速进行反索引的实现,前提是构建中的pattern中的每一项的usigned表示都在一个字节(表长)内。 若bitmark构建失败,程序应当使用正在进行的反索引的朴素实现版本。 更多...

Public 类型

typedef unsigned char index_type
 

Public 成员函数

constexpr void bitmark_data_initer (size_t init_to) noexcept
 
 bitmark_for_quick_unindex () noexcept=default
 
constexpr bool mark (const array_like_view_t< T > &pattern) noexcept
 
constexpr size_t operator[] (T &index) const noexcept
 

Public 属性

size_t _bitmark [number_of_possible_values_per< index_type >] {}
 

详细描述

template<typename T>
struct elc::defs::base::range_n::bitmark_for_quick_unindex< T >

bitmark提供了一种快速进行反索引的实现,前提是构建中的pattern中的每一项的usigned表示都在一个字节(表长)内。 若bitmark构建失败,程序应当使用正在进行的反索引的朴素实现版本。

在文件 all_defs.cpp11519 行定义.

成员类型定义说明

◆ index_type

构造及析构函数说明

◆ bitmark_for_quick_unindex()

template<typename T >
elc::defs::base::range_n::bitmark_for_quick_unindex< T >::bitmark_for_quick_unindex ( )
defaultnoexcept

成员函数说明

◆ bitmark_data_initer()

template<typename T >
constexpr void elc::defs::base::range_n::bitmark_for_quick_unindex< T >::bitmark_data_initer ( size_t  init_to)
inlineconstexprnoexcept

在文件 all_defs.cpp11523 行定义.

11523 {
11524 for(auto& i:_bitmark)
11525 i=init_to;
11526 }
constexpr T down_cast(U a) noexcept
向下转型至
size_t _bitmark[number_of_possible_values_per< index_type >]

◆ mark()

template<typename T >
constexpr bool elc::defs::base::range_n::bitmark_for_quick_unindex< T >::mark ( const array_like_view_t< T > &  pattern)
inlineconstexprnoexcept

在文件 all_defs.cpp11529 行定义.

11529 {
11530 bitmark_data_initer(npos);
11531 #define failed bitmark_data_initer(npos),false
11533 size_t i=0;
11534 const size_t end=pattern.size();
11535 while(i<end){
11536 auto&ch=pattern[i];
11537 if(::std::make_unsigned_t<T>(ch) >= number_of_possible_values_per<index_type>)
11538 return failed;
11539 auto&index=_bitmark[index_type(ch)];
11540 if(index!=npos)
11541 return failed;
11542 index=i;
11543 i++;
11544 }
11545 }
11546 else{
11547 size_t i=0;
11548 const size_t end=pattern.size();
11549 while(i<end){
11550 auto&ch=pattern[i];
11551 auto&index=_bitmark[index_type(ch)];
11552 if(index!=npos)
11553 return failed;
11554 index=i;
11555 i++;
11556 }
11557 }
11558 #undef failed
11559 return true;
11560 }
#define failed
constexpr void bitmark_data_initer(size_t init_to) noexcept

◆ operator[]()

template<typename T >
constexpr size_t elc::defs::base::range_n::bitmark_for_quick_unindex< T >::operator[] ( T &  index) const
inlineconstexprnoexcept

在文件 all_defs.cpp11561 行定义.

11561 {
11563 if(::std::make_unsigned_t<T>(index) >= number_of_possible_values_per<index_type>)
11564 return npos;
11565 return _bitmark[index_type(index)];
11566 }

类成员变量说明

◆ _bitmark

在文件 all_defs.cpp11521 行定义.

11521{};

该结构体的文档由以下文件生成: