Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.24)

project(
dice-template-library
VERSION 2.5.0
VERSION 2.6.0
DESCRIPTION
"This template library is a collection of template-oriented code that we, the Data Science Group at UPB, found pretty handy. It contains: `switch_cases` (Use runtime values in compile-time context), `integral_template_tuple` (Create a tuple-like structure that instantiates a template for a range of values), `integral_template_variant` (A wrapper type for `std::variant` guarantees to only contain variants of the form `T<IX>` and `for_{types,values,range}` (Compile time for loops for types, values or ranges))."
HOMEPAGE_URL "https://dice-research.org/")
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ A C++23 compatible compiler. Code was only tested on x86_64.
## Include it in your projects
### Conan
You can use it with [conan](https://conan.io/).
To do so, you need to add `dice-template-library/2.5.0` to the `[requires]` section of your conan file.
To do so, you need to add `dice-template-library/2.6.0` to the `[requires]` section of your conan file.

## Build and Run Tests and Examples

Expand Down
12 changes: 12 additions & 0 deletions include/dice/template-library/macro_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,16 @@
#define DICE_FILENAME __FILE__
#endif // __FILE_NAME__


#if defined(__has_include) && __has_include(<sanitizer/lsan_interface.h>) && (defined(__SANITIZE_ADDRESS__) || __has_feature(address_sanitizer) || __has_feature(leak_sanitizer))
#include <sanitizer/lsan_interface.h>
/**
* Tell the leak sanitizer to ignore that the given object is leaked.
*/
#define DICE_IGNORE_LEAK(ptr) __lsan_ignore_object(ptr)
#else
#define DICE_IGNORE_LEAK(ptr)
#endif


#endif // DICE_TEMPLATELIBRARY_MACROUTIL_HPP
12 changes: 11 additions & 1 deletion tests/tests_macro_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,14 @@ TEST_SUITE("macro_util") {
DICE_IDENT_CONCAT(hello_, MY_IDENT) = 12;
CHECK_EQ(hello_world, 12);
}
}

TEST_CASE("filename") {
std::string_view const f = DICE_FILENAME;
CHECK(f.ends_with("tests_macro_util.cpp"));
}

TEST_CASE("ignore leak") {
auto *my_obj = new int{42};
DICE_IGNORE_LEAK(my_obj);
}
}
Loading