This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
SmartAdder.cpp | |
Brief: When concepts make template candidate resolution easier! This is a toy example. | |
Working Link: https://godbolt.org/z/sWWehffdT | |
Date: 05/28/2024 | |
*/ | |
#include <exception> | |
#include <iostream> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
MyFirstTuple.cpp | |
Date: 05/28/2024 | |
*/ | |
#include <exception> | |
#include <iostream> | |
/// utility struct extracting a type name from a variadic list of type names |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <vector> | |
#include <iostream> | |
// item counting helper, base case | |
template <template<typename> typename V, typename T, typename... Args> | |
[[nodiscard]] constexpr size_t deduceItemTotal(const V<T>& arg) { | |
return arg.size(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
enum class SumMode | |
{ | |
odd, // sum by 2n+1 indexing, n = 0 | |
even // sum by 2n indexing, n = 0 | |
}; | |
template <SumMode M, typename T> | |
constexpr T sumOther (...) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
/** | |
@description Idx is the countdown to find the item in argv. | |
If the countdown is at least the size of the remaining args for a base case, | |
it would have reached 0 out of bounds. That condition would result in a defaulted value. | |
@note Only works with copyable types. | |
*/ | |
// case 1: handle 1 arg |