I'm trying to meter std::function< > into a std::set< > . For this, we need a function that compares the values entered.
As std::function does not provide any comparison operator, I thought about this:
#inc...
I'm using templates in C ++ and I'm new to this, so I do not quite understand how to "reuse" functions regardless of the type of data.
I have the code shown below:
template<typename T>
const T &min(const T &a, const T &b)...
How the compiler resolves the case in which it can substitute more than one template and does not give ambiguity using the SFINAE principle.
#include <stdio.h>
#include <iostream>
template<typename T, typename U>
U cast(T x)...
I have this code in which I try to approximate the natural logarithm of a number, but I can not use if , while or for , only the if ternario, but at the time it compiles I'm shot errors that T is ambiguous and th...
I have a simple program that uses a variable template of type std::initializer_list that stores pairs that contain a type and a text:
using name_t = const char *;
template <typename key_t>
using key_name_t = std::pair<key_t, n...
I want to extract a data from a class; Currently, I use an auxiliary variable for it.
To work, it works ... but I was wondering if it could be done in another way, saving me the variable inside the function Envoltura::result( ) :
#inc...
I'm doing a program in C ++ that overload the operators. For example, for the operator * you would like it to be multiplied:
Cuadrado a(2.1);
Circulo b(1.3);
Circulo b(4.3);
Triangulo x= a * b * c
I have created the operation Cuad...
Good morning
I am creating a method member of a class, that allows me to receive an object and save the information of the object in a file.
MyClase::guardarDatos(Objeto a);
Specifically, I need to save three objects that are derived fro...
I'm trying to check if a value exists within a dictionary list. Use flask 1.0.2. See the example below:
person_list_dict = [
{
"name": "John Doe",
"email": "[email protected]",
"rol": "admin"
},
{...
A design pattern not very well known is the PassKey pattern that is used mainly to restrict access to certain public functions (the option would be to use friend in the main classes and that produces too much coupling).
A basic implementation...