python (65.1k questions)
javascript (44.2k questions)
reactjs (22.7k questions)
java (20.8k questions)
c# (17.4k questions)
html (16.3k questions)
r (13.7k questions)
android (12.9k questions)
Virtual function with non-shared method
I'm on a personal project and I need to do something unusual. My code is kinda long but the problem comes from the structure so I'll use a very simplified version of the problem.
I have two classes (...
NiwdEE
Votes: 0
Answers: 1
Ensure derived class implements static method while maintaining default move / move assign
I'd like to ensure some derived classes implement a static method and found this SO question: Ensure derived class implements static method The top answer uses CRTP to solve the issue with a static_as...
Verwirrt
Votes: 0
Answers: 2
CRTP base private constructor and derived friend class cause compilation error using C++17 and uniform initialization
I've got the following code:
struct B
{
B(int) {}
};
template <typename T>
class Base : public B
{
friend T;
Base() : B(1) {}
};
class Derived : public Base<Derived>
{
public:
...
bielu000
Votes: 0
Answers: 1
c++ - valid use of CRTP std::variant with two elements, but no more
I'm trying to use CRTP with std::variant to achieve a classic Expression class, for example in some algebraic data type
data Expr = Num Int
| Add Expr Expr
| Sub Expr Expr
...
I use CR...
farmerzhang1
Votes: 0
Answers: 1