Data dodania Pytanie
2017-10-01 17:10 Generate random string isn't always returning the correct length »
I am working on a project where I need to generate a random string. It's mostly working, except for some reason, every now and again, the string retur...
(1) odpowiedzi
2017-10-01 14:10 Why doesn't an if constexpr make this core constant expression error dissappear? »
In reference to this question. The core constant expression that is used to initialize the constexpr variable y is ill-formed. So much is a given. Bu...
(3) odpowiedzi
2017-09-30 21:09 get<string> for variants fail under clang++ but not g++ »
The following code: variant<string> x = "abc"; cout << get<string>(x) << "\n"; works fine under g++ (version 7.2). However,...
(1) odpowiedzi
2017-09-30 20:09 Static vs. Member Operator Overloads: std::operator<< and std::ostream::operator<< »
The ostream class of C++ provides many default overloads for operator<<, however they are not all defined in the same way. The overloads for ch...
(1) odpowiedzi
2017-09-30 00:09 Fastest way to find other node »
I have a triangle class, with pointers to nodes (n0,n1,n2). I also have a method that returns the 'other' node when passed two node pointers (a,b). ...
(1) odpowiedzi
2017-09-30 00:09 gcc std::regex with -fpack-struct seg faults »
Consider the following simple c++ program #include <iostream> #include <regex> int main(int argc, char * argv[]) { std::regex foobar(...
(1) odpowiedzi
2017-09-29 22:09 Poor performance of C++ function in Cython »
I have this C++ function, which I can call from Python with the code below. The performance is only half compared to running pure C++. Is there a way ...
(1) odpowiedzi
2017-09-29 17:09 Behind the scenes of returning value from function c++ »
What is the behind the scenes of returning value from function in c++? In my understanding whenever func. is called the returning address and stack f...
(3) odpowiedzi
2017-09-29 16:09 Default argument allowing constructor to call private method »
I have the class class A { public: class Key { Key() {} Key(Key const &) {} }; A(Key key, int a = 5) {} }; The...
(1) odpowiedzi
2017-09-29 12:09 I have data duplicates when I try to import data from database Access to my database Postgresql, by c++ code »
In my code I use a simple INSERT after take data by database access This is my function where I create a query INSERT. When I open the table in pgadmi...
(0) odpowiedzi
2017-09-28 15:09 Is everything after an exporting namespace not exported? »
I was reading about modules, and I wished to do something like this: a.cpp module foo.a; export namespace foo { struct A { void doA(); ...
(0) odpowiedzi
2017-09-28 12:09 Does this function have explicit return values on all control paths? »
I have a Heaviside step function centered on unity for any data type, which I've encoded using: template <typename T> int h1(const T& t){ ...
(3) odpowiedzi
2017-09-28 10:09 Where is it a good idea to use "std::valarray"? »
I read about std::valarray in a C++ book writen by Nicolai M. Josuttis. He writes in his book The C++ Standard Library, chapter 17.4: The valarray...
(1) odpowiedzi
2017-09-27 23:09 Is it always the case that sizeof(T) >= alignof(T) for all object types T? »
For any object type T is it always the case that sizeof(T) is at least as large as alignof(T)? Intuitively it seems so, since even when you adjust th...
(4) odpowiedzi
2017-09-27 13:09 What is a fast integer ? What defines how fast an integer is? »
I am not a C++ expert but I started learning through www.learncpp.com which is great btw, and I suggest for any new c++ learner and in this topic: ht...
(2) odpowiedzi
2017-09-27 13:09 Is there any point in using `override` when overriding a pure virtual function? »
For example: class Base { virtual void my_function() = 0; }; class Derived : Base { void my_function() override; }; From what I read, the over...
(4) odpowiedzi
2017-09-27 11:09 ARC doesn't work in Objective-C++ »
I've got a c++ function that gets a std::map object and convert it to CFMutableDisctionryRef in order to use it on method CFNotificationCenterPostNoti...
(2) odpowiedzi
2017-09-27 08:09 What exactly is std::labs() there for? »
I read about the std::abs() function when browsing cppreference. On that page I have also seen a std::labs() function. Which has the same prototype a...
(1) odpowiedzi
2017-09-26 22:09 Overloading template class with template function »
C++ allows to use class and function with the same name in one namespace: struct S {}; void S() {} In this case pure name S means function S. To us...
(2) odpowiedzi
2017-09-26 21:09 incorporating a line of objC in C++ header »
I am using the Syphon framework to serve video frames to a client. There is one line of code I need to use to serve the frames through the server, and...
(1) odpowiedzi
2017-09-26 15:09 Do uninitialized objects exist in C++? »
If all objects have at least one constructor be it default c'tor defined by the compiler or user defined then how can objects be uninitialized. ...
(2) odpowiedzi
2017-09-26 12:09 Having issues with code now giving expected output »
Having issues getting this graded properly. It keeps showing up as 87% out of 100, but all of the prerequisites are functioning as they should. The pr...
(2) odpowiedzi
2017-09-26 12:09 What is the difference between typedef int array[3] and typedef int(array)[3]? »
I recently came across this unorthodox way to define a int array type: typedef int(array)[3]; At first I thought it was an array of function pointe...
(3) odpowiedzi
2017-09-26 04:09 For C++ Vector3 utility class implementations, is array faster than struct and class? »
just out of curiosity, I implemented vector3 utilities in 3 ways: array (with a typedef), class and struct This is the array implementation: typedef...
(2) odpowiedzi
2017-09-25 13:09 Can I implement max(A, max(B, max(C, D))) using fold expressions? »
While trying to play around with C++17 fold expressions, I tried to implement max sizeof where result is maximum of the sizeof of types. I have an ugl...
(8) odpowiedzi
2017-09-25 11:09 Is "enum class" a class type in C++? »
I read about enumeration declaration in C++ using cppreference. Then I have made Enum class and check whether it is a class type or not using std::is...
(2) odpowiedzi
2017-09-25 07:09 Silent breaking of constructor calls after adding initializer_list constructor »
Let's consider the following: #include <iostream> #include <initializer_list> class Foo { public: Foo(int) { std::cout <&...
(3) odpowiedzi
2017-09-24 13:09 ambiguous call of overloaded template with parameter (const T&, const T&) or (const char (&)[N], const char (&)[M]) »
For the following code: #include <iostream> using std::cout; using std::endl; template <typename T> int compare(const T&, const T&am...
(1) odpowiedzi
2017-09-24 12:09 C++ STL set usage »
I have a std::set of a structure like the one given below: struct weight{ int y; int w; }; with the comparator defined as: bool operator <(con...
(2) odpowiedzi
2017-09-24 11:09 When to use std::invoke instead of simply calling the invokable? »
As I understand, std::invoke allows me to do something like: std::invoke(f, arg1, arg2, ...); Is there a scenario when it's more advantageous than ...
(1) odpowiedzi
2017-09-24 11:09 Add pointer to defined Objective-C class in .h file of Objective-C++ »
Is possible to create class in Objective-C++ which has field that is a pointer to an Objective-C interface ( inside the .h file ) ? To clarify a litt...
(1) odpowiedzi
2017-09-24 09:09 Can bitwise operators have undefined behavior? »
Bitwise operators (~, &, | and ^) operate on the bitwise representation of their promoted operands. Can such operations cause undefined behavior? ...
(1) odpowiedzi
2017-09-23 15:09 GetThreadContext() returning 87 »
I'm trying to get the thread context of suspended WordPad. However, no matter what changes I make to the code, it returns 87. STARTUPINFO si = { ...
(1) odpowiedzi
2017-09-23 14:09 Is static initialization guaranteed here? »
Look at this code: struct Foo { void *ptr; constexpr Foo() : ptr(nullptr) { } }; Foo f; Is it guaranteed that f will be staticall...
(3) odpowiedzi
2017-09-23 08:09 What is the purpose of "int mask = ~0;"? »
I saw the following line of code here in C. int mask = ~0; I have printed the value of mask in C and C++. It always prints -1. So I do have some ...
(6) odpowiedzi