This file contains hidden or 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> | |
#include <string> | |
using namespace std; | |
template <typename Child> | |
struct Routing | |
{ | |
Routing() = delete; | |
explicit Routing(std::string s) : t(s) {} | |
void Get() |
This file contains hidden or 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 3.0) | |
project(x) | |
file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/include/fonts.hpp" | |
"#include <iostream>\ninline int Print() { std::cout << \"Running.\\n\"; return 0; }\n") | |
file(WRITE "${CMAKE_CURRENT_SOURCE_DIR}/test/main.cpp" | |
"#include \"fonts.hpp\"\nint main() { return Print(); }\n") | |
add_library(Fonts INTERFACE) | |
target_include_directories(Fonts INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/include") |
This file contains hidden or 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 <chrono> | |
#include <future> | |
#include <iostream> | |
#include <string> | |
#include <thread> | |
void DoStuff() { | |
std::cout << "Starting task.\n"; | |
std::this_thread::sleep_for(std::chrono::seconds(2)); | |
} |
This file contains hidden or 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> | |
#include <memory> | |
#include <string> | |
#include "boost/optional.hpp" | |
int main() { | |
std::unique_ptr<std::string> ptr(new std::string("A")); | |
boost::optional<std::string> opt_empty; | |
boost::optional<std::string> opt_full("A"); | |
std::cout << "ptr: " << sizeof(ptr) << '\n'; |
This file contains hidden or 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.8 FATAL_ERROR) | |
project(Test) | |
# Create main.cpp which uses gmock | |
file(WRITE src/main.cpp "#include \"gmock/gmock.h\"\n\n") | |
file(APPEND src/main.cpp "struct A {\n virtual void Do() {}\n};\n\n") | |
file(APPEND src/main.cpp "struct MockA : public A {\n MOCK_METHOD0(Do, void());\n};\n\n") | |
file(APPEND src/main.cpp "TEST(A, Do) {\n") | |
file(APPEND src/main.cpp " MockA mock_a;\n") | |
file(APPEND src/main.cpp " EXPECT_CALL(mock_a, Do()).Times(testing::AtLeast(1));\n") |
This file contains hidden or 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 <condition_variable> | |
#include <thread> | |
#include "boost/thread/condition_variable.hpp" | |
#include "boost/thread/thread.hpp" | |
template<typename Thread, typename Lock, typename CondVar> | |
void Loop() { | |
for (int i = 0; i < 10000; ++i) { | |
CondVar condition_variable; |
NewerOlder