Skip to main content

All Questions

Tagged with
2 votes
1 answer
34 views

Python Django access fields from inherited model

Hi I have a question related to model inheritance and accessing the fields in a Django template. My Model: class Security(models.Model): name = models.CharField(max_length=100, blank=False) class ...
Dennis's user avatar
  • 99
-3 votes
1 answer
71 views

Hit a snag whilst adding a subclass to std::vector

My idea was initially to create my own custom vector with methods built in for various mathematical calculations, as well as the usual std::vector features, for the sake of regression analysis. I ...
Ashley Ben Story's user avatar
0 votes
1 answer
51 views

How to access Base template parameters from Derived that is intended as a specialization?

Because partial specialization of a templated member function is not possible in C++ I now try to circumvent this through class template inheritance. In this approach, I derive from the base class, ...
Numaerius's user avatar
  • 383
0 votes
1 answer
23 views

Again on Django template inheritance [duplicate]

The difficulty I have is precisely described in Django Accessing Parent Data in templates from child data but the answer given there, accepted by the OP, is given in the “recipe” spirit, as are an ...
troppapolvere's user avatar
0 votes
2 answers
104 views

Deduce template parameter based on function to override of a base class

Let's start with some code. class intClass { public: virtual ~intClass() = default; virtual int sum(int a, int b) const = 0; }; class doubleClass { public: virtual ~doubleClass() = ...
user avatar
0 votes
0 answers
18 views

Access a member of base class if both base and derived classes are nested inside of a template class [duplicate]

template <class T> struct outer { struct base { int x; }; struct derived : public base { void func() { ++x; } }; }; This code produces an ‘x’ was not declared in ...
Pootis Spencer's user avatar
1 vote
0 answers
45 views

templated class segfaults when using inheritance [duplicate]

I am currently working on a raytracer, and I am trying to output the result using multiple ways at the same time (only through PPM format and using SFML atm). To achieve that, I wrote an IOutput ...
1ups_'s user avatar
  • 45
0 votes
0 answers
90 views

C++ Templates for inheritance - How to use constructor?

I'm working on a C++ project where I use templates to easily switch between implementations of several inherited classes. Combined with ceres solver, I've come across this situation where I need to ...
rrofa's user avatar
  • 11
-1 votes
1 answer
60 views

How to make a std::shared_ptr type argument convert to Base Class automatically?

#include <utility> #include "iostream" template<class Vty> class Base { public: Base(Vty value) : _baseValue(std::move(value)) {} virtual auto print() -> void { ...
MikuSoft's user avatar
-1 votes
1 answer
90 views

How to override a template function in Subclass?

I want to make GroupBase as a interface... #include "string" #include "unordered_map" template<class Vty> class BaseV { public: BaseV() { //logic } ...
MikuSoft's user avatar
0 votes
0 answers
42 views

Why can't I access the protected member of a class when deriving it with CRTP pattern? [duplicate]

Why can't I access parent's class from derived class when using CRTP patten (see Base class)? template <typename Derived> class Common { protected: int common; }; template <typename Derived&...
Happytreat's user avatar
0 votes
1 answer
76 views

How to protect a templated derived class after being cast from a base class having the incorrect template type being used?

I'm trying to write a container that handles a vector of ObjArray's which is a templated class. ObjArray inherits from a base class and the container holds a list of base pointers which I cast to the ...
DWil's user avatar
  • 35
2 votes
2 answers
205 views

CRTP design where base class instantiates members of types specified by the derived class

As described in crtp-pass-types-from-derived-class-to-base-class by Evg, the compiler is unable to deduce the type Impl::TType in the declaration of class Base: template <typename Impl> struct ...
lobelk's user avatar
  • 23
0 votes
0 answers
49 views

Inherit custom operator= from template base class [duplicate]

I have a template base class that implements void operator=(T value). Then I have a derived template class which should just inherit that operator, but this doesn't work. (See compile error in the ...
Thomas Klier's user avatar
0 votes
1 answer
91 views

Nested template class with std::enable_if, C++

I have a template class B whose first parameter T1 must inherit class A, and second parameter T2 is used in nested class C: class A { ... }; template<typename T1, typename T2 = T1, typename = std::...
chchchch's user avatar

15 30 50 per page
1
2 3 4 5
103