From 7f6015a81b5996e4a2877cb7b6ef407248a5dcf9 Mon Sep 17 00:00:00 2001 From: Vesa Karvonen Date: Sun, 13 Oct 2019 01:56:33 +0300 Subject: [PATCH] WIP --- .clang-format | 4 + .cppsm | 1 + .gitignore | 1 + .gitmodules | 4 + .prettierrc | 7 + .travis.yml | 24 +++ CMakeLists.txt | 3 + internals/CMakeLists.txt | 1 + internals/testing/compile_synopsis_test.cpp | 47 +++++ provides/core/CMakeLists.txt | 1 + .../core/include/trade_core_v2/library.hpp | 136 +++++++++++++ .../core/include/trade_core_v2/private.hpp | 114 +++++++++++ .../core/include/trade_core_v2/synopsis.hpp | 56 ++++++ provides/full/CMakeLists.txt | 2 + provides/full/include/trade_v2/library.hpp | 6 + provides/full/include/trade_v2/synopsis.hpp | 11 ++ provides/ptrs/CMakeLists.txt | 2 + .../ptrs/include/trade_ptrs_v2/library.hpp | 181 ++++++++++++++++++ .../ptrs/include/trade_ptrs_v2/private.hpp | 70 +++++++ .../ptrs/include/trade_ptrs_v2/synopsis.hpp | 84 ++++++++ 20 files changed, 755 insertions(+) create mode 100644 .clang-format create mode 160000 .cppsm create mode 100644 .gitignore create mode 100644 .gitmodules create mode 100644 .prettierrc create mode 100644 .travis.yml create mode 100644 CMakeLists.txt create mode 100644 internals/CMakeLists.txt create mode 100644 internals/testing/compile_synopsis_test.cpp create mode 100644 provides/core/CMakeLists.txt create mode 100644 provides/core/include/trade_core_v2/library.hpp create mode 100644 provides/core/include/trade_core_v2/private.hpp create mode 100644 provides/core/include/trade_core_v2/synopsis.hpp create mode 100644 provides/full/CMakeLists.txt create mode 100644 provides/full/include/trade_v2/library.hpp create mode 100644 provides/full/include/trade_v2/synopsis.hpp create mode 100644 provides/ptrs/CMakeLists.txt create mode 100644 provides/ptrs/include/trade_ptrs_v2/library.hpp create mode 100644 provides/ptrs/include/trade_ptrs_v2/private.hpp create mode 100644 provides/ptrs/include/trade_ptrs_v2/synopsis.hpp diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..a7afac0 --- /dev/null +++ b/.clang-format @@ -0,0 +1,4 @@ +BinPackArguments: false +BinPackParameters: false +ColumnLimit: 80 +IndentWidth: 2 diff --git a/.cppsm b/.cppsm new file mode 160000 index 0000000..82ee378 --- /dev/null +++ b/.cppsm @@ -0,0 +1 @@ +Subproject commit 82ee3785488605383bcc4eff65fcb82e3730a703 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..677a6fc --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.build* diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..38bfab5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule ".cppsm"] + path = .cppsm + url = https://github.com/cppsm/cppsm-boilerplate.git + branch = master diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..3030ecd --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "bracketSpacing": false, + "printWidth": 80, + "semi": false, + "singleQuote": true, + "proseWrap": "always" +} diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..e1f37b4 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,24 @@ +language: cpp + +notifications: + email: false + +matrix: + include: + - os: linux + dist: xenial + - os: osx + osx_image: xcode10.2 + - os: windows + +git: + depth: 1 + submodules: false + +before_install: + - export -f travis_nanoseconds travis_time_start travis_time_finish + - if [ "$TRAVIS_OS_NAME" = windows ]; then choco upgrade -y git.install; fi + +script: + - if ! [ -x .cppsm/travis-ci ]; then git submodule --quiet update --init --no-recommend-shallow --depth 1 .cppsm; fi + - .cppsm/travis-ci diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..adc13f9 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.10) +project(trade_cpp) +include(.cppsm/c++17.cmake) diff --git a/internals/CMakeLists.txt b/internals/CMakeLists.txt new file mode 100644 index 0000000..5c836a4 --- /dev/null +++ b/internals/CMakeLists.txt @@ -0,0 +1 @@ +add_conventional_executable_tests(PRIVATE trade_v2) diff --git a/internals/testing/compile_synopsis_test.cpp b/internals/testing/compile_synopsis_test.cpp new file mode 100644 index 0000000..16a1d8d --- /dev/null +++ b/internals/testing/compile_synopsis_test.cpp @@ -0,0 +1,47 @@ +#include "trade_v2/synopsis.hpp" + +static_assert(std::is_nothrow_swappable_v>); +static_assert(sizeof(trade_v2::atom)); +static_assert(sizeof(trade_v2::atom>)); + +#include "trade_v2/library.hpp" + +#include + +int main() { + { + using t = int; + trade_v2::atom x; + static_assert(trade_v2::atom_traits::is_atomic); + } + + { + using t = std::pair; + trade_v2::atom x(101, false); + } + + { + struct t { + size_t more; + size_t than; + size_t two_words; + }; + + static_assert(trade_v2::atom_traits::is_trivial); + } + + { + using t = std::shared_ptr; + trade_v2::atom x; + static_assert(!trade_v2::atom_traits::is_trivial && + !trade_v2::atom_traits::is_atomic); + } + + { + using t = trade_v2::sole_ptr; + trade_v2::atom x; + static_assert(trade_v2::atom_traits::is_atomic); + } + + return 0; +} diff --git a/provides/core/CMakeLists.txt b/provides/core/CMakeLists.txt new file mode 100644 index 0000000..9b80112 --- /dev/null +++ b/provides/core/CMakeLists.txt @@ -0,0 +1 @@ +add_conventional_library(trade_core_v2) diff --git a/provides/core/include/trade_core_v2/library.hpp b/provides/core/include/trade_core_v2/library.hpp new file mode 100644 index 0000000..1928a69 --- /dev/null +++ b/provides/core/include/trade_core_v2/library.hpp @@ -0,0 +1,136 @@ +#pragma once + +#include "trade_core_v2/synopsis.hpp" + +// + +template