Skip to content

AlexeyPerestoronin/Cpp_TypesList

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TypesList

It is a library provided structs (and type-constructor-struct) for manipulation of types as if a list-data-structure is used


Content

  • namespace: TL:
    • struct: Always(True|False) - returns boolean (true/false) regardless of type
    • struct: TypeInfo - if Type is compatibility - provides information about type; compilation error - vise versa
    • struct: TypesList - base struct of TL-logic is one list of cpp-types
    • struct: CreateTypesList - creates arbitrary length list of types
    • struct: GetTypeByIndex - get Type from TypesList by index
    • struct: GetIndexByType - get index inside TypesList by which target Type is placed
    • struct: IsInList - check if Type is in TypesList
    • struct: AppendBack - appends one type or arbitrary length types list at the end of the target TypesList
    • struct: AppendFront - appends one type or arbitrary length types list at the end of the target TypesList to front
    • struct: InsertByIndex - insert one type or arbitrary length types list at the target TypesList by index
    • struct: RemoveBack - removes last type from target TypesList
    • struct: RemoveFront - removes first type from target TypesList
    • struct: RemoveByIndex - removes type from target TypesList by index
    • struct: RemoveFromSize - removes the types since from-index to from+size-index from target TypesList
    • struct: CutFromSize - cuts out the types since from-index to from+size-index from target TypesList
    • struct: Count - counts the quantity of entries of the Type (or Types) in target TypesList
    • struct: Remove - removes the Type from target TypesList, leave only a given quantity of occurrences
    • struct: RemoveAll - removes all occurrences of the Type (or Types) from target TypesList
    • struct: RemoveAllCopy - leaves only one occurrences of the Type (or Types) in target TypesList
    • struct: Refine - refine TypesList making its more beautiful: (1) only one occurrence for each types
    • struct: Replace - replaces Before-type to After-type in target TypesList, leaved only a given quantity occurrences
    • struct: ReplaceAll - replaces Before-type to After-type in target TypesList
    • struct: Swap - swaps two types by its indexes in target TypesList
    • struct: SwapTypes - swaps two types in target TypesList

Suggestions for improvement

  • develop and use sc_string-cpp-class which provides static-compiler-strings, and use it for modernize static assertion messages as:
    • before: static_assert(!std::is_same_v<NullType, TypesList>, "Type is not existent inside TypesList");
    • after: static_assert(!std::is_same_v<NullType, TypesList>, sc_string("Type") + sc_string(TypeInfo<NullType>::name) + sc_string("is not existent inside TypesList"));
  • by using of cs_string-type need implement extended TypeInfo-struct for TypesList-struct which will defined the name and description fields as (for example):
    • uint8_t + uint16_t + uint32_t + uint64_t
    • 8-bit size unsigned integer STL-type + 16-bit size unsigned integer STL-type + 32-bit size unsigned integer STL-type + 641-bit size unsigned integer STL-type
  • make substitute (1) #define TL_TYPE uint8_t and (2) #define TL_TYPE_MAX UINT8_MAX and use them

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages