@ -4,9 +4,11 @@
test: test/test
test/test: test/test.cpp
$(CXX) -I. --std=c++20 $< -o $@
$(CXX) -I. --std=c++20 -Wall -pedantic $< -o $@
if strings $@ | grep Hello; then exit 1; fi
./$@
strings $@ | grep bOFFE >> /dev/null
@echo ""
@echo "Passed."
clean:
@ -9,6 +9,7 @@ namespace frob
}
template<std::size_t N>
requires(N > 0)
struct cfrob
{
char out[N]{};
@ -19,11 +20,6 @@ namespace frob
out[N-1] = 0;
};
template<>
struct cfrob<0>
char out[0]{};
template<frob::cfrob C>
@ -3,7 +3,12 @@
#include <cfrob.hpp>
const auto str = "Hello world."_frob;
// Can be stored as `const char` array with compile-time size for optimal use.
constexpr const char* str2 = "Hello world."_frob;
// Can also be stored as normal `const char*` string constant pointer.
const char* str3 = "Hello world."_frob;
int main()