Skip to content

Commit

Permalink
distinguish between function types and function pointer types
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackMATov committed Jul 6, 2023
1 parent 444f98e commit 4b63a62
Show file tree
Hide file tree
Showing 29 changed files with 392 additions and 166 deletions.
1 change: 0 additions & 1 deletion ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
- type conversions
- non-linear search of methods/functions/...
- register base types by `META_HPP_ENABLE_POLY_INFO`
- distinguish between function types and function pointer types
- add the library version to sources
- fix all includes to work with the library more flexible
- `try_invoke`/`is_invocable` should return error codes
Expand Down
8 changes: 4 additions & 4 deletions develop/manuals/meta_manuals/function_manual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ namespace
TEST_CASE("meta/meta_manuals/function/type") {
namespace meta = meta_hpp;

// resolves a function type by pointer
const meta::function_type add_function_type = meta::resolve_type(&add);
// resolves a function type by reference
const meta::function_type add_function_type = meta::resolve_type(add);

// also, it can be resolved by static function type declaration
CHECK(add_function_type == meta::resolve_type<int(*)(int, int)>());
CHECK(add_function_type == meta::resolve_type<int(int, int)>());

// checks a return value type
CHECK(add_function_type.get_return_type() == meta::resolve_type<int>());
Expand Down Expand Up @@ -55,7 +55,7 @@ TEST_CASE("meta/meta_manuals/function/usage") {
CHECK(sub_function == math_scope.get_function_with<int, int>("sub"));

// checks a type of the found function
CHECK(sub_function.get_type() == meta::resolve_type<int(*)(int, int)>());
CHECK(sub_function.get_type() == meta::resolve_type<int(int, int)>());

// checks the ability to call the function with specific arguments
CHECK(sub_function.is_invocable_with(60, 18));
Expand Down
Loading

0 comments on commit 4b63a62

Please sign in to comment.