inheriting-constructors Questions
3
Solved
I have this example:
#include <iostream>
#define print(X) std::cout << X << std::endl
struct B1 {
B1(int _i = 5): i(_i) { print("B1 constructor"); };
int i;
};
struc...
Hemicrania asked 10/7 at 7:43
1
Solved
Consider:
struct B {
void f();
private:
B(int, int = 0);
};
struct D : B { using B::B; };
void B::f() {
auto a = D{0};
auto b = D(0);
auto c = D(0, 0);
D x{0};
D y(0);
D z(0, 0);
}
GCC acc...
Dirham asked 16/12, 2020 at 9:9
2
This story is similar to my previous question. All versions of GCC that support C++11, have this exact behaviour. I could not find any other compiler that struggles with my test case.
The test cas...
Periclean asked 19/5, 2017 at 5:50
1
Solved
In this example:
template<class T>
struct S : T
{
using T::X;
};
T::X is a dependent name that refers to the member X in T.
If S<T> is instantiated with T = X:
struct X
{
X(int) {...
Noll asked 7/4, 2017 at 2:3
1
Solved
I'm not sure if it's a bug of the GCC compiler or the intended behavior of noexcept.
Consider the following example:
struct B {
B(int) noexcept { }
virtual void f() = 0;
};
struct D: public B {...
Byssinosis asked 4/3, 2016 at 7:27
2
Solved
While reading this question, I found a strange point:
template <typename T>
class Subclass : public Baseclass<T>
{
public:
using typename Baseclass<T>::Baseclass;
// ^^^^^^^^
}...
Chopfallen asked 20/9, 2014 at 0:16
1
Solved
I tried to create a class deriving from boost::multiprecision::mpz_int and to have it inherit the base class constructors:
#include <boost/multiprecision/gmp.hpp>
using namespace boost::mul...
Except asked 23/7, 2014 at 13:49
1
I am encountering the following error in my project:
error: use of deleted function ‘C::C(int)’ note: ‘C::C(int)’ is
implicitly deleted because the default definition would be ill-formed:
error: ...
Matamoros asked 29/8, 2014 at 18:45
1
Solved
Assuming the following layout:
class Base
{
protected:
Base(P1 p1, P2 p2, P3 p3);
public:
virtual void SomeMethod() = 0;
}
class Derived : public Base
{
public:
using Base::Base;
public:
vi...
Paff asked 9/1, 2014 at 9:13
2
Solved
I'm about to create an exception class hierarchy which conceptually looks somewhat like this:
#include <iostream>
#include <stdexcept>
class ExceptionBase : public std::runtime_error ...
Alchemy asked 16/10, 2013 at 9:23
1
© 2022 - 2024 — McMap. All rights reserved.