initial commit
This commit is contained in:
commit
75799f4652
9 changed files with 316 additions and 0 deletions
1
example/CMakeLists.txt
Normal file
1
example/CMakeLists.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
add_subdirectory(ex1)
|
||||
15
example/ex1/CMakeLists.txt
Normal file
15
example/ex1/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# xo-stringliteral/example/ex1/CMakeLists.txt
|
||||
|
||||
set(SELF_EXE xo_stringliteral_ex1)
|
||||
set(SELF_SRCS ex1.cpp)
|
||||
|
||||
add_executable(${SELF_EXE} ${SELF_SRCS})
|
||||
xo_include_options2(${SELF_EXE})
|
||||
|
||||
# ----------------------------------------------------------------
|
||||
# dependencies..
|
||||
|
||||
xo_self_dependency(${SELF_EXE} xo_stringliteral)
|
||||
#xo_dependency(${SELF_EXE} reflect)
|
||||
|
||||
# end CMakeLists.txt
|
||||
38
example/ex1/ex1.cpp
Normal file
38
example/ex1/ex1.cpp
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/* @file ex1.cpp */
|
||||
|
||||
#include "xo/stringliteral/stringliteral.hpp"
|
||||
#include "xo/stringliteral/stringliteral_iostream.hpp"
|
||||
#include "xo/stringliteral/string_view_concat.hpp"
|
||||
#include <iostream>
|
||||
|
||||
int
|
||||
main() {
|
||||
using namespace std;
|
||||
using xo::stringliteral;
|
||||
using xo::stringliteral_compare;
|
||||
|
||||
#ifdef NOT_USING
|
||||
constexpr stringliteral s1("hello");
|
||||
|
||||
static_assert(stringliteral_compare(s1, s1) == 0);
|
||||
|
||||
cerr << s1 << endl;
|
||||
|
||||
constexpr stringliteral s2 = stringliteral_concat(stringliteral("hello"),
|
||||
stringliteral(", world"));
|
||||
|
||||
#endif
|
||||
|
||||
static constexpr string_view hello("hello");
|
||||
static constexpr string_view world(" world");
|
||||
|
||||
static constexpr auto s2 = concat_v<hello, world>;
|
||||
|
||||
static constexpr string_view hello_world("hello world");
|
||||
|
||||
static_assert(s2 == hello_world);
|
||||
|
||||
cerr << hello_world << endl;
|
||||
}
|
||||
|
||||
/* end ex1.cpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue