Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [c++14]

The C++14 tag is for questions that are specific to the C++ standard "C++14".

1
vote
3answers
229 views

What is late binding?

I know, there are lots of sources on the internet, but I do not understand them. Wikipedia: "Late binding, dynamic binding, or dynamic linkage is a computer programming mechanism in which the method ...
0
votes
1answer
99 views

How to signal end of stream?

I am designing an interface for reading and writing video frames to various inputs and outputs. Stream operators seem to me a superb alternative to named functions for the task. This is the gist of it:...
-1
votes
1answer
94 views

Any need for constexpr in tag values?

Tag dispatching is used to: dispatch based on properties of a type Is there any reason to make tag values constexpr or even const? There are code samples demonstrated both constexpr and non-const ...
1
vote
1answer
182 views

Remove duplicated switch statements caused by not knowing type at compile time of opencv matrix?

I have a situation that occurs 5 times in my code, and continues to grow. Basically I have the same switch statement structure every time I need to perform an operation that involves my matrix and ...
-1
votes
1answer
491 views

Does it make sense to iterate a ranged for loop using constant reference here?

I have the following code, and I was wondering if I'm optimally iterating through my ranged for loop: struct data_type { int a; int b; }; int main() { // Assume I have initialized a ...
1
vote
3answers
153 views

Reduce return type repetition of functions

As an exercise, I recently implemented a simple settings reader class which reads setting values from an INI file into an std::map<std::string, std::string>. The reader method looks like ...
3
votes
1answer
526 views

Hash Table with iterators as the keys, is this poor design and can I do this better?

I'm developing a program where twice I've found the solution to a problem was to use hash tables with iterators as keys and some other arbitrary type as the value. I found my self using this pattern ...
0
votes
1answer
128 views

Function returning different tuples [closed]

I am trying to learn C++11/14 new features and I am playing with tuple and variadic. I wonder if it is possible to use tuples to return multiple values that are not fixed at compile time. Something ...
-1
votes
4answers
128 views

Base global system for two customizable subcomponents

The following explanation is rather detailed, but I think if I simplified the problem at hand no proper answer could be given. I'm working on a scripting system for a game (for end users rather than ...
2
votes
5answers
816 views

Handling errors for non-exceptional cases in modern C++

To hone my skills - and for the pleasure of it - I am writing a small game for my kids in modern C++ (C++11, C++14 and the part of C++17 already supported by Visual Studio), which is a nice break from ...
2
votes
3answers
5k views

Is overriding a pure virtual function with default arguments is good or bad?

Is overriding a pure virtual function with default arguments is good or bad? class Base { public: virtual int func(int i, int j = 10) = 0; }; class Derived : public Base { public: int func(...
1
vote
1answer
913 views

How can I copy and alter object with unique_ptr in it?

I basically have the following situation: +------------------+ | | | Input object | ...
1
vote
2answers
225 views

Smart pointer use in GUI library

Rolling my own GUI library for a side-project. Refactoring to use smart pointers; however, I ran into an issue. I'm aware that you do not want to to use smart pointers across DLL boundaries for ...
5
votes
3answers
9k views

Is there any benefit to to define constant local variables as static ( c++)?

void Animation::playAnimation() const { static const int index = 0; const std::string& animationFileName = m_animationContainer.getAnimationName(index); static const int zOrder = -...
5
votes
4answers
552 views

Storing objects whose size are run-time dependent contiguously in memory

The background I am working on an ECS in C++ for fun and I am trying to make it as efficient as possible. One of the optimisations I am striving to implement is to minimise cache misses by storing ...
35
votes
2answers
3k views

How does Rust diverge from the concurrency facilities of C++?

Questions I am trying to understand whether Rust fundamentally and sufficiently improves upon the concurrency facilities of C++ so that to decide if I should spend the time to learn Rust. ...