Skip to main content
8 votes
1 answer
127 views

I have a template<int d> class Monomial and a template<int d> class Polynomial. Polynomial<d> owns a std::map<Monomial<d>, double>. I would like to create a member ...
BenPol's user avatar
  • 93
Advice
2 votes
4 replies
249 views

Any C++ class can be first forward declared, and defined only later in the program. Are function-local classes an exception from this rule? Please consider a simplified program: auto f() { struct ...
Fedor's user avatar
  • 24.7k
7 votes
1 answer
202 views

In C++, forward declarations introduce an incomplete type. Incomplete types can be used to declare pointers, but they cannot be used to initialize values or access members because the complete ...
Connor Lawson's user avatar
2 votes
1 answer
210 views

I am working on a project in my spare time, and have been told to forward declare whenever possible. My project includes nlohmann::json across several files, so I thought to try and forward declare it ...
Lukas Kronholm's user avatar
3 votes
1 answer
131 views

In order to hide template function definition in .cpp file, while having the forward declaration in a header file (function is used by a class template), the template has to be instantiated in order ...
Sergey Kolesnik's user avatar
5 votes
1 answer
86 views

When repeating the declaration of a template class with defaulted argument, I get an error: <source>:12:23: error: redefinition of default argument for 'class<template-parameter-1-2>' ...
Sergey Kolesnik's user avatar
1 vote
1 answer
56 views

I have this code on ADT specification of a node typedef int ElType; typedef node* Address; typedef struct node{ ElType info; Address next; } Node; Does it going to be the same if i do this? ...
Awafi's user avatar
  • 11
2 votes
2 answers
92 views

I'm currently working in C++ with the elfutils library and I'm struggling with something that should be obvious. Here is a MCVE that shows my problem: file.cpp struct Elf64_Sym; #include <elf.h>...
Forbinn's user avatar
  • 85
5 votes
2 answers
161 views

$ g++ --version Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1 Apple clang version ...
ps_'s user avatar
  • 148
-1 votes
1 answer
679 views

This is a question that has been debated many times in this forum. There is however a case that i have not seen a good way to solve. from __future__ import annotations class ClassA: pass class ...
Maeglin's user avatar
  • 47
1 vote
1 answer
94 views

Consider a pair of classes which represent the same thing in Python and each implements a method that converts one to the other. As an example consider transforming from cartesian to polar coordinates ...
roschach's user avatar
  • 9,636
3 votes
1 answer
117 views

I'm not sure if my question title is the most appropriate and I will change it happily to something clearer if I get adequate suggestion. In a C++ video whose subject is not the one here, I saw this ...
Oersted's user avatar
  • 3,834
0 votes
1 answer
164 views

Let's suppose I want to declare structs A and B struct A{ B toB(){ return B(); } }; struct B{ A toA(){ return A(); } }; I'll get an error that type B is undefined main.cpp:2:2: error: ...
BlobKat's user avatar
  • 320
0 votes
0 answers
47 views

So, here I have two classes, one has the friend function definition and the other a private data member. I want to access the private data member with the friend member function but it gives me an ...
Tobías Milano's user avatar
0 votes
1 answer
277 views

I am trying understand how I can declare, in a nim source, different procedures that call each other, as it sounds like the compiler expects all calls to come after the declaration, but the procedures ...
GiMS_Pang's user avatar

15 30 50 per page
1
2 3 4 5
73