Skip to content

The-Mastermind1/Compile_Time_Library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Compile Time Library 🚀⏳

🔷 C++ Templates & Metaprogramming 🏗️📦

💡EXPLANATION:

▶️BEGIN

1)This library 936 line of code it is well detailed of what it does

2) the Macros.h header serves as a helper library to write exception and macros for the header.h and concepts that will be used at header.h

3)The header.h simply contains simple utility functions that can be used at compile time

4) inside this library there are various of functions structs and classes that use templates pretty much to give result at compile time

5)some of them use template recursive instantiation to give the result like: Is_Prime,Sqrt,Factorial,Fibonnaci,Max,Min,Terms

6)some of them are simple funcs that use recursion to give the result like :
Str_Len,Parce_Integer,Binary_To_Decimal,Sqrt_For_Doubles,GCD,Popcount

🔚END

📖DETAILED EXPLANATION:

▶️BEGIN




1) There is a struct Supports_Sizeof which simply checks if you can apply sizeof operator into the passed type ,this uses SFINAE CONTEXT

2) there is also a better version of void that solves most of the problems that std::void_t has


3)there is also a struct called dimensions which is pretty much the same with the std::rank from C++ Standard , i thought about it alone

4) there is also a struct called Largest_Type which takes a list of types and gives the type that is the largest in bytes

5)there are two funcs that check if a string is palidrome you can use whoever you want

6)there is also a wrapped struct called Identity that is used inside void t and largest_type

7)the struct has_size simply checks if the type passed supports a method called size();

8)there is also a struct called Type_Index that takes a list of types and then returns the index of the desired type

9) The C++ Standard contains in the header a struct called std::conditional_t which takes a bool condition a first type and a second type and based on the condition it returns the first or the second type

10)i also created something like this but with values and is called If_Then_Else which based on a bool condition and two values that you gave it return one of them

10)there is also a func called Factorial which returns the result but it used for loop not template recursive instantiation

11)the func Make_Reversed_String return the string that is given reversed

12)the func Type_Name gives back the name of the type you gave it along with something else

13)inside the Array_Algorithms class there are simple compile time algorithms for the array and one at runtime like :

Binary_Search,Is_Sorted,Is_NxN ,dotproduct,doaddition,dosubtraction, print1D_array,Linear_Search,Bubble_Sort,Reverse_Array

14)There is also a func called Is_Equal_Strings

🆘 GCD=GREATEST COMMOND DIVISOR🆘

15)Popcount counts the number of ones that the binary represntation of n has

16)I Wanted a min max that could work with more arguments

17)there is also a struct called Abs and a func Is_Equal

18)Power of Integers gives the result x^n

19)the func called terms can be used to give the result of e^x and uses an approximation to do that, not the best func .... you are the one that gives the iterations be careful with that ,the more iterations the better

FINALLY

🔚END

👥CONTRIBUTORS:

~The-Mastermind1

🙏 Thank You for Reading!

I appreciate your interest in my project! 🚀

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages