Skip to content

cpp-core/so

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

107 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stack Overflow Code

This repo contains code related to Stack Overflow Questions and Answers. The code related to each Question is in an independent directory named after the Question title.

  • fiesty -- Efficient pseudo-random permutation.
  • pfr -- Basic structure reflection.
  • primes -- Checking uniqueness of shifting sieve of eratosthenes
  • rshift -- C++ Bitwise shift of uint64_t in vector.
  • static-assert -- Type constraining template parameters inside concept.
  • compound -- Find compound words
  • bitset -- Bitset series
  • partition -- Partition sequence

If you need to install a particular version of clang for a build on Ubuntu, you can do something like the following:

apt install -y clang-15 libc++-15-dev libc++abi-15-dev

On older versions of Ubuntu (e.g. 20.04), you may have to point to the clang packages before installing with something like:

wget https://apt.llvm.org/llvm.sh
./llvm.sh 15

Efficient pseudo-random permutation

git clone [email protected]:cpp-core/so.git
mkdir so/76076957/build
cd so/76076957/build
CC=clang-mp-15 CXX=clang++-mp-15 cmake ..
make feisty && ./bin/feisty -r 3 -m 0:100000000 -p
 Permutation:  3854 ms

Basic structure reflection

git clone [email protected]:cpp-core/so.git
mkdir so/76168305/build
cd so/76168305/build
CC=clang-mp-15 CXX=clang++-mp-15 cmake ..
make scalr_struct && ./bin/scalar_struct

Checking uniqueness of shifting sieve of eratosthenes

git clone [email protected]:cpp-core/so.git
mkdir so/76107531/build
cd so/76107531/build
CC=clang-mp-15 CXX=clang++-mp-15 cmake ..
make primes && ./bin/primes
 sieve_index:   187 ms
    sieve_2n:     0 ms
    sieve_6n:     0 ms

C++ Bitwise shift of uint64_t in vector

git clone [email protected]:cpp-core/so.git
mkdir so/76128087
cd so/76128087/build
CC=clang-mp-15 CXX=clang++-mp-15 cmake ..
make right_shift && ./bin/right_shift -n 128 -m 37
                                     110100001001000110111011010111000010001010101110100111101111011011100111111000011111101011101110110101011100001100011111011110010010000010000010001101010010110011111000000001111011011111011111
000000000000000000000000000000000000011010000100100011011101101011100001000101010111010011110111101101110011111100001111110101110111011010101110000110001111101111001001000001000001000110101001

Type constraining template parameters inside concept

git clone [email protected]:cpp-core/so.git
mkdir so/76114394/build
cd so/76114394/build
CC=clang-mp-15 CXX=clang++-mp-15 cmake ..
make static_assert && ./bin/static_assert

Find compound words

git clone [email protected]:cpp-core/so.git
mkdir so/76178746/build
cd so/76178746/build
CC=clang-mp-15 CXX=clang++-mp-15 cmake ..
make compound && ./bin/compound

Bitset series

git clone [email protected]:cpp-core/so.git
mkdir so/76185918/build
cd so/76185918/build
CC=clang-mp-15 CXX=clang++-mp-15 cmake ..
make bits && ./bin/bits

Partition sequence

git clone [email protected]:cpp-core/so.git
mkdir so//build
cd so//build
CC=clang-mp-15 CXX=clang++-mp-15 cmake ..
make partition && ./bin/partition

About

Code related to Stack Overflow Questions and Answers related to C++

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Contributors