We’re rewarding the question askers & reputations are being recalculated! Read more.
5

About the code: List& operator =(const List<T>&)=default; and List(const List<T>&)=default; provide excellent opportunity to get double delete with 100% chance of success. Your linked list required data to be copyable and it copies it on usage. It is bad, since now you cannot store data like std::unique_ptr that are not copyable. ...


4

Do not cast the result of malloc. If your code does #include <stdlib.h>, the cast is redundant. If it does not, the cast just masks the warning, which may lead to hard to find bugs. Prefer sizeof(object) to sizeof(type). The latter leads to the double maintenance problem, in case the type is changed. I strongly recommend to have a constructor-like ...


3

Welcome to Code Review! Bugs For every node you insert, next is null. Encapsulation Your code is written almost exclusively using C features. First things first, instead of using a single global variable, use a class to encapsulate the data structure. class Stack { public: Stack() = default; Stack(const Stack&) = delete; Stack& ...


1

The code looks nice! Here are my suggestions. The compiler flags Right now, you are using this command to compile the code: g++ -std=c++17 -g -Wall main.cpp -o main There are three additional flags that you should normally use: -pedantic-errors — raises errors on non-standard GCC extensions, which are enabled by default. -Werror — turns ...


1

OK, so what I understand, class MassiveDTO will be instantiated sometimes in your application, but those 3 lists can be static and won't change. So solution is create classes with static hard coded lists (3 classes) and just use static reference them in MassiveDTO: public class MassiveDTO { private List<String> company = CompanyDataHolder....


1

So you need to separate the construction of that class from the class itself? This is the Factory Pattern. Data class Boil down to your DTO to ... well the data. public class MassiveDTO { private final List<String> company; private final List<String> partners; private final List<String> biodata; /** * @see ...


Only top voted, non community-wiki answers of a minimum length are eligible