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> | |
template<typename T> | |
struct LambdaTraits | |
{ | |
using ReturnType = typename LambdaTraits<decltype(&T::operator())>::ReturnType; | |
}; | |
template<typename ClassType, typename Return, typename... Args> | |
struct LambdaTraits<Return(ClassType::*)(Args...) const> | |
{ |
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<nbdl> | |
#include "catch.hpp" | |
struct Type1 {}; | |
struct Type2 {}; | |
struct Type3 {}; | |
struct Type4 {}; | |
template<typename T> | |
int getInt(T tag) | |
{ |
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<string> | |
#include<nbdl> | |
#include "catch.hpp" | |
TEST_CASE("Unitialized variant should match Unresolved.", "[variant]") | |
{ | |
using Number = nbdl::Variant<int, std::string, float>; | |
Number number; | |
REQUIRE(number.match( | |
[](nbdl::Unresolved) { |
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<boost/hana.hpp> | |
namespace hana = boost::hana; | |
constexpr auto my_sequence = hana::tuple_t<int, float, char>; | |
constexpr auto my_sequence_reversed = hana::tuple_t<char, float, int>; | |
static_assert(hana::reverse(my_sequence) == my_sequence_reversed, ""); | |
int main() |
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<boost/hana.hpp> | |
#include<vector> | |
#include<iostream> | |
namespace hana = boost::hana; | |
struct Tag1 {}; | |
struct Tag2 {}; | |
struct Tag3 {}; |
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<boost/hana.hpp> | |
namespace hana = boost::hana; | |
auto list_with_no_dups = | |
hana::unpack( | |
hana::range_c<int, 0, 50>, | |
[](auto... i) { | |
return hana::tuple_c<int, i...>; | |
}); |
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
cmake_minimum_required(VERSION 2.8) | |
add_definitions(-std=c++14) | |
add_definitions(-Wall) | |
add_definitions(-Wextra) | |
include_directories("/usr/local/include") | |
add_executable(large_map_1 | |
large_map_1.cpp |
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
function is_prime(n : integer) | |
if n ≤ 1 | |
return false | |
else if n ≤ 3 | |
return true | |
else if n mod 2 = 0 or n mod 3 = 0 | |
return false | |
let i ← 5 | |
while i×i ≤ n | |
if n mod i = 0 or n mod (i + 2) = 0 |
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
CC=clang++ -std=c++14 | |
all: main | |
main: main.cpp all.hpp.pch | |
$(CC) main.cpp -include-pch all.hpp.pch -o main | |
all.hpp.pch: expensive.hpp | |
$(CC) expensive.hpp -o all.hpp.pch |
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<type_traits> | |
#include<iostream> | |
template<typename T1, typename T2> | |
class Moo | |
{ | |
T1 t1; | |
T2 t2; | |
public: |
OlderNewer