1
0

Compare commits

...

2 Commits

Author SHA1 Message Date
22df1139aa
feat(wip): if constexpr 2023-10-22 21:49:29 +02:00
7a2400ec62
fix: symlink to compile_commands.json 2023-10-22 21:49:29 +02:00
6 changed files with 27 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/.build
/.cache
/bin
compile_commands.json

View File

@ -1,3 +1,4 @@
#!/usr/bin/env sh
cmake -S . -B .build -G Ninja -D CMAKE_EXPORT_COMPILE_COMMANDS=ON
ln -s .build/compile_commands.json

View File

@ -1,6 +1,12 @@
add_library(
chapter_02 src/initlist.cpp src/null.cpp src/constexp.cpp src/ifswitch.cpp
src/structured_binding.cpp src/type_inference.cpp)
chapter_02
src/initlist.cpp
src/null.cpp
src/constexp.cpp
src/ifswitch.cpp
src/structured_binding.cpp
src/type_inference.cpp
src/if_constexpr.cpp)
target_compile_features(chapter_02 PUBLIC cxx_std_20)

View File

@ -0,0 +1,9 @@
#pragma once
#include "chapter_interface.h"
class IfConstexprTest : public ChapterTest {
public:
virtual void run() override;
virtual const char *name() const override { return "If constexpr test"; }
};

View File

@ -0,0 +1,6 @@
#include <iostream>
#include <type_traits>
#include "if_constexpr.h"
void IfConstexprTest::run() {}

View File

@ -4,6 +4,7 @@
#include <vector>
#include "constexp.h"
#include "if_constexpr.h"
#include "ifswitch.h"
#include "initlist.h"
#include "null.h"
@ -24,6 +25,7 @@ int main(int argc, char **argv) {
chapter_2_tests.emplace_back(std::make_unique<InitListTest>());
chapter_2_tests.emplace_back(std::make_unique<StructuredBindingTest>());
chapter_2_tests.emplace_back(std::make_unique<TypeInferenceTest>());
chapter_2_tests.emplace_back(std::make_unique<IfConstexprTest>());
for (auto &test : chapter_2_tests) {
std::cout << "\n" << test->name() << ":" << std::endl;