Data dodania Pytanie
2017-03-18 16:03 How to set 3-key sequence shortcut with two key modifiers in Qt? »
I have been trying to set a shortcut as "Ctrl+Shift+C". I have tried the following ways: QAction *generalControlAction = new QAction(this); generalC...
(2) odpowiedzi
2017-03-18 06:03 Puzzling performance difference between mac and a relatively powerful desktop »
My original intention for writing this piece of code is to measure performance difference when an entire array is operated on by a function vs operati...
(1) odpowiedzi
2017-03-18 05:03 Optimizing portable 128-bit integer shifts on a 32-bit architecture »
In my spare time I've been working on a utility library that among other things, supports signed/unsigned 128-bit integers. This library uses cpu-disp...
(2) odpowiedzi
2017-03-17 13:03 How do I use a preprocessor macro inside an include? »
I am trying to build freetype2 using my own build system (I do not want to use Jam, and I am prepared to put the time into figuring it out). I found s...
(2) odpowiedzi
2017-03-17 10:03 Variadic template specialization with const reference »
How to specialize variadic template function that has const reference for an argument? Example: template<typename T, typename... Args> T foo(A...
(2) odpowiedzi
2017-03-17 00:03 Befriending a template template parameter »
I've got a class template with a template template parameter, and I want to declare this parameter (that is, all of its specializations) as a friend. ...
(0) odpowiedzi
2017-03-16 17:03 Derived class is able to access its base class' private member »
I have run into a strange situation where my derived class is able to access a private member of its base class where templates are involved. Cons...
(1) odpowiedzi
2017-03-16 13:03 What is the operator "" in C++? »
I fell on this page where the author talks about the standardisation of the operator "": The decision of the C++ standards committee to standardis...
(2) odpowiedzi
2017-03-16 06:03 Why can std::apply call a lambda but not the equivalent template function? »
The following code snippet (compiled using gcc 6.3.0 on OS X with -std=c++17) demonstrates my conundrum: #include <experimental/tuple> templat...
(1) odpowiedzi
2017-03-15 17:03 How to alias a nested template class with variadic parameter packs »
Is there any way one can alias a nested template class with a using keyword? Something like this template <typename... Types> struct Something...
(2) odpowiedzi
2017-03-15 10:03 dummy() function - What is that supposed to be? »
So yesterday I read this question here on SO and stumbled over the best voted answer, wich used code like this to call a lambda recursively std::func...
(2) odpowiedzi
2017-03-15 10:03 Why can a strongly-typed enum be initialized with an integer without static_cast? »
enum class E {}; int main() { E e1{ 0 }; // ok E e2 = 0; // not ok // error : cannot initialize a variable of // type 'E' with an rv...
(1) odpowiedzi
2017-03-14 22:03 Call C++ recursive lambda in the same line where it is declared. »
This is mostly a one liner style type of question, I would normally write this code in multiple lines anyway for readability reasons. So my question ...
(5) odpowiedzi
2017-03-14 20:03 Inline comments for if/else on the same line with the opening brace? »
Which of the below variants is better/best, and why? NOTE: the comments below are intended to document the result of the if/else operation (e.g. "cat...
(0) odpowiedzi
2017-03-14 16:03 How do you share Java functions without giving others source code? »
When programming in C++ we have header files and source files. When our company sells our product (which is just a library of useful functions essenti...
(1) odpowiedzi
2017-03-14 15:03 How can I override a class scoped `__declspec(dllexport)` annotation on a per-member basis? »
On ELF targets, if I have class Foo and I have given it default visibility via a declaration like class __attribute__((visibiility("default"))) Foo, I...
(1) odpowiedzi
2017-03-14 02:03 shared_ptr strangeness with null values and custom deleter »
We recently came across a crash when moving from a unique_ptr to a shared_ptr, using a custom deleter. The crash happened when the pointer used to cre...
(1) odpowiedzi
2017-03-13 16:03 C++11 Enum forward causes "underlying type mismatch" »
I'm working in C++11 and including an h file implemented in C++03. In the h file I'm including there's an enum Foo defined. I want to declare a forwar...
(2) odpowiedzi
2017-03-13 14:03 How to define non-member operator overload for class template? »
I have a class template that has a constructor taking an std::chrono::duration, because I want to be able to use the chrono_literals to construct it. ...
(2) odpowiedzi
2017-03-13 10:03 How to detect symmetries in 4 integer variables efficiently? »
I want to find symmetries in 4 integer variables i,j,k and l . The symmetries are: all four numbers are equal: XXXX, three numbers are equal: XXXY...
(3) odpowiedzi
2017-03-13 00:03 Is the Visual C++ implementation of std::async using a thread pool legal »
Visual C++ uses the Windows thread pool (Vista's CreateThreadpoolWork if available and QueueUserWorkItem if not) when calling std::async with std::lau...
(0) odpowiedzi
2017-03-12 22:03 What is the proper usage of a constexpr standard functor? »
Take the following code: #include <iostream> #include <functional> template <template<typename> class Op> auto applyOp(const...
(1) odpowiedzi
2017-03-12 16:03 Concatenating a sequence of std::arrays »
Consider the following: (Wandbox) #include <array> #include <algorithm> #include <iostream> template<typename T, int N, int M&g...
(7) odpowiedzi
2017-03-12 03:03 C++ template: The static member in a global object is not initialized »
I have a piece of simple C++ code, in which I defined a template and a global object by specializing the template. The object constructor accesses a s...
(1) odpowiedzi
2017-03-11 15:03 mismatched std::allocator for some of STL containers »
Is it technically valid to use mismatched std::allocator specialization (surely, except it's specialization for void) as a template parameter for STL ...
(1) odpowiedzi
2017-03-11 09:03 Qt Disable Windows 10 Game Bar »
I have an application developed in Qt that causes Windows 10 to think it is a game, and opens a pop up box that says Press the Win-key + G to open the...
(1) odpowiedzi
2017-03-11 00:03 name lookup rules in template function »
#include <iostream> using namespace std; template<typename T> void adl(T) { cout << "T"; } struct S { }; template<typename T...
(1) odpowiedzi
2017-03-10 21:03 valarray with arithmetic operations return type »
When I write a simple arithmetic expression with valarray and assign the result to auto I get a segfault when I try to access the result on gcc. #inc...
(0) odpowiedzi
2017-03-10 16:03 using std::bind with std::reference_wrapper::get »
I'm trying to use std::bind to call std::reference_wrapper::get but I can't get it to compile. I'm sure I'm overlooking something obvious but the comp...
(1) odpowiedzi
2017-03-10 16:03 Taking predicates by value »
Various containers in the standard library take predicates by value. For example: From §23.3.5 std::list template <class Predicate> void rem...
(0) odpowiedzi
2017-03-10 14:03 Order a list depending on other list »
Given: struct Object { int id; ... }; list<Object> objectList; list<int> idList; What is the best way to order objectList depe...
(6) odpowiedzi
2017-03-10 13:03 Why does every STL container have a swap function defined as a member function? »
Consider the queue container in STL. It is my understanding that swap() available in the <algorithm> header would work just fine. I understand...
(2) odpowiedzi
2017-03-09 23:03 Why don't I need template parameters in this particular case? »
I have this code: struct Base {}; template<typename T> struct Foo : Base {}; struct Bar { template<typename T> // v--- Wh...
(2) odpowiedzi
2017-03-09 18:03 C++11 usage of delete specifier vs private functions »
I am in the process of boning up on my C++ (as in, attempting to get into more modern-style coding) and am looking at the delete specifier. It is my u...
(3) odpowiedzi
2017-03-09 15:03 Best practice C++: Reuse default arguments for multiple methods »
Given a header file that has different functions (function1 and function2): what is the best practice of sharing the same default arguments? class My...
(2) odpowiedzi