#include <stdio.h>
#include <iostream>
#include <typeinfo>
template <class T>
class A {
public:
A(){};
~A(){};
typedef T custom;
custom num = 1;
T get() {
return num;
}
void print() {
std::cout << get() << " " << typeid(num).name() << "\n";
}
};
class B : public A<float> {
public:
B() : A() { num = 2.f; };
~B(){};
};
int main() {
B b;
b.print();
return 0;
}
QEventLoop loop;
QFutureWatcher watcher = QConcurrent::run(someFunc);
connect(&watcher, &QFutureWatcher::finished, &loop, &QEventLoop::quit);
loop.exec();
auto result = watcher.result();
template<typename... Funcs>
auto compose_sq(Funcs&&... funcs)
{
return [=]{ (std::invoke(funcs), ...); };
}
int main()
{
auto f1 = []{ std::cout << "f1" << std::endl; };
auto f2 = []{ std::cout << "f2" << std::endl; };
auto f3 = compose_sq(f1, f2);
f3();
return 0;
}