I'm trying to write a function that measures the time of execution of other functions. It should have the same return type as the measured function. T ...
I'm trying to write a function that measures the time of execution of other functions. It should have the same return type as the measured function. T ...
I want to use a lambda to evaluate (switch-case) some conditions and return a lambda accordingly. Sadly things aren't working. What I am doint wron ...
So I have this class template with a single attribute value of type T where I try to overload the + operator, s.t. adding two objects of this class re ...
In the following snippet, the function B::f() is a "wrapper" around the function A::f(). But I assume that A::f() return type is an "opaque" type whic ...
There is an allocator: template<typename T> class pool_allocator { public: using value_type = T; using pointer = value_type *; /* ...
(I've not found much by searching for return statement, return deduce, and similar, with tags c++optional.) Why does this work #include <optional ...
I have How do I derive the return type from DistanceFunc for DistanceType? ...
I want to write a type-safe function in C++ that composes an arbitrary number of maps. I approached by writing a helper function point that computes t ...
Assume I have an iterator referencing a std::pair. It might point into a map, so first_type would be const. But it might also be a vector of pairs, an ...
Some time ago I defined my first three-way comparison operator. It compared a single type and replaced multiple conventional operators. Great feature. ...
there is some functors with return type deduction, including lambda expressions. constexpr auto a = [](auto&& x){ return x + 1; }; struct X{ ...
Most of the time, the C++17 inferred return type of a simple member function can be easily transformed to a C++11 trailing return type. For example, ...
c++17 introduces template <class Fn, class...ArgTypes> struct is_invocable: Determines whether Fn can be invoked with the arguments ArgTypes ...
Here's a code sample where I test two &strs and return one of them: It didn't compile requesting explicit lifetimes so I provided them: Now, ...
what are the advantages of using over isn't auto compiled into the appropriate type during template instantiation? ...
I would like to combine return type deduction and explicit template instantiation (e.g. f<int> instead of template<typename T> f<T>) ...
I'm new to Rust and I wanted to learn the language and get a better understanding by implementing some small projects. My first attempt was to parse J ...
I have a list of abstract class's pointers. The class is defined as follows, and i need to get the derived class from the contained object later on: ...
Suppose I have to following function: Op is assumed to have the following method: (this is a simple case; actually it might have more parameters ...
I'm trying to accomplish the below.. But of course it doesn't work for the commented reasons. I know I could... 1) specialize the function outsi ...