-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
923 additions
and
715 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
BasedOnStyle: WebKit | ||
AccessModifierOffset: '-2' | ||
AlignAfterOpenBracket: Align | ||
AlignConsecutiveAssignments: 'false' | ||
AlignConsecutiveDeclarations: 'false' | ||
AlignOperands: 'true' | ||
AlignTrailingComments: 'true' | ||
AllowShortBlocksOnASingleLine: 'true' | ||
AllowShortFunctionsOnASingleLine: All | ||
AllowShortIfStatementsOnASingleLine: 'true' | ||
AllowShortLoopsOnASingleLine: 'false' | ||
AlwaysBreakTemplateDeclarations: 'Yes' | ||
BreakBeforeBraces: Allman | ||
BreakConstructorInitializersBeforeComma: 'true' | ||
ConstructorInitializerAllOnOneLineOrOnePerLine: 'true' | ||
ConstructorInitializerIndentWidth: '2' | ||
ContinuationIndentWidth: '4' | ||
ColumnLimit: 0 | ||
Cpp11BracedListStyle: 'true' | ||
DerivePointerAlignment: 'false' | ||
FixNamespaceComments: 'true' | ||
KeepEmptyLinesAtTheStartOfBlocks: 'false' | ||
Language: Cpp | ||
MaxEmptyLinesToKeep: '1' | ||
NamespaceIndentation: All | ||
PointerAlignment: Left | ||
SortIncludes: 'true' | ||
IncludeCategories: | ||
- Regex: '^<.*>$' | ||
Priority: 1 | ||
- Regex: '^".*"$' | ||
Priority: 2 | ||
SpaceAfterCStyleCast: 'false' | ||
SpaceBeforeAssignmentOperators: 'true' | ||
SpaceBeforeParens: ControlStatements | ||
SpaceInEmptyParentheses: 'false' | ||
SpacesBeforeTrailingComments: '2' | ||
SpacesInAngles: 'false' | ||
SpaceBeforeCpp11BracedList: false | ||
UseTab: Never | ||
BinPackArguments: 'false' | ||
BinPackParameters: 'false' | ||
ExperimentalAutoDetectBinPacking: 'false' | ||
AllowAllParametersOfDeclarationOnNextLine: 'false' | ||
... |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,3 +30,10 @@ | |
*.exe | ||
*.out | ||
*.app | ||
|
||
CMakeSettings.json | ||
.idea | ||
out | ||
build* | ||
cmake-build* | ||
.vs |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
cmake_minimum_required(VERSION 3.13) | ||
project(SboPtr VERSION 0.1) | ||
|
||
enable_testing() | ||
|
||
find_package(Catch2 CONFIG REQUIRED) | ||
|
||
add_library(sboptr INTERFACE) | ||
add_library(sboptr::sboptr ALIAS sboptr) | ||
|
||
target_compile_features(sboptr INTERFACE cxx_std_17) | ||
target_include_directories(sboptr INTERFACE include) | ||
target_sources(sboptr INTERFACE include/sboptr/sboptr.hpp) | ||
|
||
add_executable(sboptr_tests) | ||
target_compile_definitions(sboptr_tests PRIVATE CATCH_CONFIG_MAIN) | ||
target_sources(sboptr_tests PRIVATE tests/sboptr/sboptr_tests.cpp) | ||
target_link_libraries( | ||
sboptr_tests | ||
PRIVATE | ||
sboptr::sboptr | ||
Catch2::Catch2 | ||
) | ||
|
||
add_test(NAME sboptr_tests COMMAND sboptr_tests) | ||
|
||
add_executable(sboptr_example) | ||
target_sources(sboptr_example PRIVATE examples/example.cpp) | ||
target_link_libraries(sboptr_example PRIVATE sboptr::sboptr) |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#include <iostream> | ||
|
||
#include "sboptr/sboptr.hpp" | ||
|
||
namespace | ||
{ | ||
class interface | ||
{ | ||
public: | ||
virtual ~interface() noexcept = default; | ||
|
||
virtual void foo() = 0; | ||
}; | ||
|
||
class impl : public interface | ||
{ | ||
public: | ||
void foo() override | ||
{ | ||
std::cout << "Foo!\n"; | ||
} | ||
}; | ||
} // namespace | ||
|
||
auto main() -> int | ||
{ | ||
auto ptr = sboptr::sbo_ptr<interface, sizeof(void*) * 4>{impl{}}; | ||
ptr->foo(); | ||
|
||
return 0; | ||
} |
Oops, something went wrong.