Data dodania Pytanie
2017-12-07 20:12 What made i = i++ + 1; legal in C++17? »
Before you start yelling undefined behaviour, this is explicitly listed in N4659 (C++17) i = i++ + 1; // the value of i is incremented Yet...
(3) odpowiedzi
2017-12-07 16:12 Is `-1` correct for using as maximum value of an unsigned integer? »
Is there any c++ standard paragraph which says that using -1 for this is portable and correct way or the only way of doing this correctly is using pre...
(5) odpowiedzi
2017-12-07 10:12 Is std::any_of required to follow short circuit logic? »
Given the following code, std::vector<int> numbers = {1, 2, 3, 4, 5}; std::any_of(std::begin(numbers), std::end(numbers), [](int n...
(1) odpowiedzi
2017-12-06 16:12 Can clang-format put arguments in own lines? »
How to configure clang-format tool to format C++ code like this: unsigned long int computeCosmologicalConstant( int einsteinAge, double jupit...
(0) odpowiedzi
2017-12-06 10:12 Different code path according to different type in a template method »
Let's say I have a template class like this: template<typename TRequest, typename TResponse = void> class handler { private: TResponse proc...
(1) odpowiedzi
2017-12-06 08:12 When defining a prototype of an overloaded C++ function template, is it legal to use its name to refer to previous definitions? »
Let's say we want to overload a function template f, but only if a similar overload is not declared yet: template<typename T> void f(T); // mai...
(1) odpowiedzi
2017-12-06 07:12 Analyzing spikes in performance measurement »
I have a set of C++ functions which does some image processing related operation. Generally I see that the final output is delivered in 5-6ms time ra...
(3) odpowiedzi
2017-12-06 01:12 Can I detect at compile time "function arguments" that are compile-time constants »
Can I detect at compile time whether "function arguments"1 are compile-time constants? For example a function print(int i) that can print "constant 5...
(2) odpowiedzi
2017-12-05 17:12 React Native 0.40.0: Ordered comparison between pointer and zero ('NSNumber *' and 'int') »
I have a React Native project that is still on 0.40.0 and when I try to build in XCode for Simulator: Ordered comparison between pointer and zero ('N...
(1) odpowiedzi
2017-12-05 15:12 Changed rules for protected constructors in C++17? »
I have this test case: struct A{ protected: A(){} }; struct B: A{}; struct C: A{ C(){} }; struct D: A{ D() = default; }; int main(){ (void)B{}; ...
(2) odpowiedzi
2017-12-05 15:12 Attributes in C++. Are they really required for programmers? »
I read that C++11 has introduced the concept of attributes for example [[noreturn]] which is to indicate that the function doesn not return to the cal...
(2) odpowiedzi
2017-12-05 13:12 Are there memset function implementations that fill the buffer in reverse order? »
I know that there are implementations of memcpy, which copied memory in reverse order to optimize for some processors. At one time, a bug "Strange sou...
(1) odpowiedzi
2017-12-04 19:12 Algorithm for accurate detection of overlap between a square and a circle? »
I am implementing (in C++) a method to detect when an overlap is occurring between two static, axis-aligned shapes on a 2d plane. The shapes are eithe...
(1) odpowiedzi
2017-12-04 15:12 What is the difference between if( pointer == NULL) and if(!pointer)? »
What is the difference in between using: if( pointer == NULL) And if(!pointer) I am concerned with the differences between the two in respect ...
(3) odpowiedzi
2017-12-04 11:12 condition_variable, mutex and flag in one struct »
Is to ok to combine all three variables into one struct? struct lock_struct { std::mutex mutex; std::conditional_variable cv; bool flag; ...
(1) odpowiedzi
2017-12-03 20:12 "Cleaning up" nested if statements »
In a console program I am creating, I have a bit of code that parses through a file. After parsing each line, it is checked for syntax errors. If the...
(3) odpowiedzi
2017-12-03 14:12 Sort struct by string value c++ »
I have a struct filled with sport activities: typedef struct{ int ID; string date; string type; double dist; double time; dou...
(1) odpowiedzi
2017-12-03 14:12 Address sanitizing Boost.Python modules »
My project includes a large C++ library and Python bindings (via Boost.Python). The test suite is mostly written on top of the Python bindings, and I...
(1) odpowiedzi
2017-12-03 09:12 What is the rationale for limitations on pointer arithmetic or comparison? »
In C/C++, addition or subtraction on pointer is defined only if the resulting pointer lies within the original pointed complete object. Moreover, comp...
(5) odpowiedzi
2017-12-03 01:12 Anonymous temporaries and class template argument deduction - gcc vs clang »
Consider the following code snippet: template <typename T> struct foo { foo(T) { } }; int main() { foo{0}; } g++ 7 happily creates a...
(1) odpowiedzi
2017-12-02 18:12 Is it legal to check whether the address of a subobject lies within the bounds of a containing object »
2 Questions: Is the following code well formed with defined behaviour? Is there any possible c++ implementation in which it could assert? Code (c+...
(1) odpowiedzi
2017-12-02 14:12 Wrong overload called when constructing from initializer_list inside parentheses »
I always thought that when I use initializer list C++ syntax like: something({ ... }); it's always clear to the compiler that I want to call the ov...
(3) odpowiedzi
2017-12-02 11:12 Can I use the result of a C++17 captureless lambda constexpr conversion operator as a function pointer template non-type argument? »
while answering this question, I tried to turn a captureless lambda into a member function pointer by exploiting the fact that, since C++17, capturele...
(1) odpowiedzi
2017-12-01 21:12 Undefined behaviour in repeated use of prefix ++ operator »
I read this answer about undefined behaviour, where I saw following statement: ++++++i; // UB, parsed as (++(++(++i))) I don't think it is unde...
(2) odpowiedzi
2017-12-01 19:12 pybind11: how to package c++ and python code into a single package? »
I am trying to package together an existing Python code and a new C++ 11 code using CMake and pybind 11. I think I am missing something simple to add ...
(2) odpowiedzi
2017-12-01 16:12 Why doesn't this enum convert to int? »
Why does the following code not compile under g++ (C++14), MSVC (C++14), or ARM (C++03)? The named Error instance calls the integer constructor, but ...
(3) odpowiedzi
2017-12-01 05:12 Bug in the C++ standard library in std::poisson_distribution? »
I think I have encountered an incorrect behaviour of std::poisson_distribution from C++ standard library. Questions: Could you confirm it is indeed...
(1) odpowiedzi
2017-11-30 23:11 Calling C++ Code with a struct from C# »
I was given a third party library that wraps unmanaged C++ code into a C# api, one of the functions has a parameter that appears to be a struct from t...
(1) odpowiedzi
2017-11-30 23:11 Can the "main" function be declared with the "noexcept" specifier? »
Is the following code valid in C++? int main() noexcept { } Both clang++ 3.8.0 and g++ 7.2.0 compile it fine (with -std=c++14 -O0 -Wall -Wextra -We...
(2) odpowiedzi
2017-11-30 14:11 Scope resolution operator being used twice »
namespace libzerocoin { //Commitment class Commitment::Commitment::Commitment(const IntegerGroupParams* p, const Bignu...
(1) odpowiedzi
2017-11-30 09:11 Is it possible to remove dispatch_once in Objective-C++? »
Since C++11, local static variables are known to be initialized in a thread safe manner (unless the -fno-threadsafe-statics is given), as specified in...
(2) odpowiedzi
2017-11-29 16:11 May a destructor be final? »
Does the C++ standard allow a destructor to be declared as final? Like this: class Derived: public Base { ... virtual ~Derived() final;...
(1) odpowiedzi
2017-11-29 10:11 const vs non-const variable with no change in value once assign »
In C++, if value of a variable never gets changed once assigned in whole program VS If making that variable as const , In which case executable code i...
(2) odpowiedzi
2017-11-29 07:11 What does C++ syntax “A::B:A {};” mean »
What does C++ syntax struct A::B:A {}; mean? Where is this name definition (or access) described in the C++ standard? #include <iostream> stru...
(2) odpowiedzi
2017-11-29 07:11 Please tell me Coding style to be oriented »
I asked some questions in stackoverflow. I was able to get a solution, but I pointed out that I was doing wrong coding. I have no place to learn the...
(0) odpowiedzi