Graphle 1.0.0
A C++20 header-only graph library
Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Functions | Variables
functional.hpp File Reference
#include <common.hpp>

Go to the source code of this file.

Classes

struct  graphle::util::no_op_t
 
struct  graphle::util::addressof_t
 
struct  graphle::util::indirect_t
 
struct  graphle::util::as_const_t
 
struct  graphle::util::pointed_to_as_const_t
 
struct  graphle::util::transpose_edge_t
 

Namespaces

namespace  graphle
 
namespace  graphle::util
 

Macros

#define GRAPHLE_MAKE_NIEBLOID(Name, Function, ...)
 
#define GRAPHLE_MAKE_NIEBLOID_IMPL(Name, Function, ...)
 

Functions

template<typename F >
constexpr auto graphle::util::transform_edge (F &&fn)
 

Variables

constexpr no_op_t graphle::util::no_op = {}
 
constexpr addressof_t graphle::util::addressof = {}
 
constexpr indirect_t graphle::util::indirect = {}
 
constexpr as_const_t graphle::util::as_const = {}
 
constexpr pointed_to_as_const_t graphle::util::pointed_to_as_const = {}
 
constexpr transpose_edge_t graphle::util::transpose_edge = {}
 

Macro Definition Documentation

◆ GRAPHLE_MAKE_NIEBLOID

#define GRAPHLE_MAKE_NIEBLOID (   Name,
  Function,
  ... 
)
Value:
__VA_OPT__(template <) __VA_ARGS__ __VA_OPT__(>) \
struct Name##_t { \
constexpr decltype(auto) operator()(auto&&... args) const { \
return Function(GRAPHLE_FWD(args)...); \
} \
}; \
\
__VA_OPT__(template <typename... Args>) \
constexpr inline Name##_t __VA_OPT__(<Args...>) Name = {}

Constructs a Niebloid function object to wrap the provided free function. VA_ARGS may be used to pass template parameters for the function object (NOT its call operator!), e.g.:

// Existing free function
template <typename T> auto my_transform(auto&&... args) { ... }
// Niebloid definition
GRAPHLE_MAKE_NIEBLOID(some_transform, my_transform<T>, typename T);
// Usage
using alias = some_transform_t<int>;
auto result = some_transform<int>(1, 2, 3, 4);
#define GRAPHLE_MAKE_NIEBLOID(Name, Function,...)
Definition: functional.hpp:24
Note
: NTTPs are currently not supported.
: If you get weird errors here using MSVC, make sure you compile with /Zc:preprocessor (The legacy preprocessor does not support VA_OPT).

Definition at line 24 of file functional.hpp.

◆ GRAPHLE_MAKE_NIEBLOID_IMPL

#define GRAPHLE_MAKE_NIEBLOID_IMPL (   Name,
  Function,
  ... 
)
Value:
struct Name##_t { constexpr static decltype(auto) operator()(auto&&) const {} }; \
constexpr inline Name##_t Name = {};

Simplified version of GRAPHLE_MAKE_NIEBLOID for Doxygen.

Definition at line 42 of file functional.hpp.