logo
down
shadow

CPP QUESTIONS

C++ Pseudo-RSA solving for d (decryption key) quickly with large numbers
C++ Pseudo-RSA solving for d (decryption key) quickly with large numbers
this one helps. the problem you are running into is: your integers are too small and will overflow when the values get larger ...fixed size integers for things like RSA ... no good idea unless you happen to have integers with a few thousand bits leng
TAG : cpp
Date : November 17 2020, 11:52 AM , By : Peter Chung
Storing lambdas as members confusion
Storing lambdas as members confusion
With these it helps Non-static data member initialisers only get used if the constructor doesn't specify a different initialiser.Given
TAG : cpp
Date : November 17 2020, 11:52 AM , By : randy k
I can no longer assign char[M][N] types into a std::vector on gcc 4.9
I can no longer assign char[M][N] types into a std::vector on gcc 4.9
Hope that helps The bare minimum requirement on value types for standard containers is that they must be Erasable. For the default allocator, this translates to the requirement that given value_type *p;, p->~value_type(); must be well-formed.If value
TAG : cpp
Date : November 17 2020, 11:52 AM , By : Danial Dani
static_cast with an explicit rvalue conversion operator
static_cast with an explicit rvalue conversion operator
Any of those help This is clang bug 19917. From the section of the standard you mentioned, §5.2.9/4:
TAG : cpp
Date : November 17 2020, 11:52 AM , By : user2950200
When are lvalues moved instead of copied in C++?
When are lvalues moved instead of copied in C++?
wish of those help Despite the fact that the move might be elided, Yes. A copy will never happen if a move constructor is available. I'll quote the paragraph again for clarity. [class.copy]/32:
TAG : cpp
Date : November 17 2020, 11:52 AM , By : sydyildirim
Designing the instantiation and destruction of a class using the pimpl idiom
Designing the instantiation and destruction of a class using the pimpl idiom
I hope this helps you . This is almost a Code Review question now, so you might want to consider posting this on CodeReview.SE. Also, it might not fit well to StackOverflow's philosophy of specific questions with specific answers, no discussion. I'll
TAG : cpp
Date : November 17 2020, 11:52 AM , By : user2950116
Is it a common practice to use public enum for containing default constants in c++?
Is it a common practice to use public enum for containing default constants in c++?
seems to work fine It's a fairly common practice, to make sure a constant is really treated as a constant in all cases.What C++ has a lot, that Java doesn't, is references to any type, even primitive types, and as a result of that,
TAG : cpp
Date : November 17 2020, 11:52 AM , By : Lin
C++ How to enumerate QGraphicsItem's?
C++ How to enumerate QGraphicsItem's?
wish helps you Using this function, I can delete selected QGraphicsItem's from a QGraphicsView. How can I get my ellipses enumerated in order to receive a notification like "Deleted ellipse n°...". , A few waysAssuming you only care about that iterat
TAG : cpp
Date : November 17 2020, 11:52 AM , By : user2950039
c++ armadillo cast/convert to integer type vector or matrix
c++ armadillo cast/convert to integer type vector or matrix
To fix the issue you can do If you are just dealing with positive values, then the conv_to function of the armadillo package will do exactly the same as the method you are trying to use.
TAG : cpp
Date : November 17 2020, 04:28 AM , By : unsure_undergrad
Null parameter check C++
Null parameter check C++
With these it helps Adding my 2 cents here. You could also use pointers directly, and send nullptr for parameters that you do not want to send values for. This is, in case you do not want to include Boost for a minor feature.
TAG : cpp
Date : November 17 2020, 04:28 AM , By : moonblack
Force evaluation of constexpr static member
Force evaluation of constexpr static member
I wish this help you The simple answer would probably be to simply add another static_assert:
TAG : cpp
Date : November 17 2020, 04:28 AM , By : Hitesh Bodar
Travis CI QT not building
Travis CI QT not building
To fix this issue You need to add widgets to get classes such as QMessageBox and QMainWindow:
TAG : cpp
Date : November 17 2020, 04:28 AM , By : user2949921
C++ Writing a file inside a loop
C++ Writing a file inside a loop
I wish did fix the issue. This should be counting 30 seconds down into a txt file. But it hardly ever makes the txt itself either. What am I doing wrong? Or is it that in loop c++ is just not capable of file handling. There is just nothing in the tex
TAG : cpp
Date : November 17 2020, 04:28 AM , By : Stone
C++ remove function: doesn't accept a string variable
C++ remove function: doesn't accept a string variable
will be helpful for those in need Assuming, filename is of type std::string, I can think of couple of ways of resolving your problem.
TAG : cpp
Date : November 17 2020, 04:28 AM , By : user2949870
Class destructor is being called twice
Class destructor is being called twice
help you fix your problem The destructor for A is called twice because there are two objects that need to be destroyed. By printing something when the copy or move constructor is called you can verify this:
TAG : cpp
Date : November 17 2020, 04:28 AM , By : CJ Summers
How to `std::bind()` a standard library algorithm?
How to `std::bind()` a standard library algorithm?
will help you When trying to std::bind() an overloaded function the compiler can't determine which overload to use: at the time the bind()-expression is evaluated the function arguments are unknown, i.e., overload resolution can't decide which overlo
TAG : cpp
Date : November 17 2020, 04:28 AM , By : rexxar06
Convert exception to optional: cant resolve overloaded function type
Convert exception to optional: cant resolve overloaded function type
Hope this helps The problem here is with template type deduction, and is one of the perfect forwarding failures. When you have an overloaded function, which one of them is supposed to be deduced for Func?There are two ways around this. Either, create
TAG : cpp
Date : November 17 2020, 01:00 AM , By : user2949685
Using boost::spirit defaulting a parsed value to an earlier value when parsing into a struct
Using boost::spirit defaulting a parsed value to an earlier value when parsing into a struct
around this issue First of all, instead of spelling out omit[+space], just use a skipper:
TAG : cpp
Date : November 17 2020, 01:00 AM , By : user2949658
Packaging a threaded program with Qt GUI
Packaging a threaded program with Qt GUI
like below fixes the issue You do not subclass QThread to run something in a different thread. QThread is used via signals/slots.http://doc.qt.io/qt-5/qthread.htmlstarted
TAG : cpp
Date : November 17 2020, 01:00 AM , By : user2949643
Strange pointer behaviour in loop
Strange pointer behaviour in loop
Does that help This expression will increment x even after the null is discovered and the loop completes:
TAG : cpp
Date : November 17 2020, 01:00 AM , By : minipc
Create type copies
Create type copies
Hope that helps As many commentators have pointed out, one solution is to use BOOST_STRONG_TYPEDEF which provides all the features requested in the question. And here's example usage from their docs:
TAG : cpp
Date : November 17 2020, 01:00 AM , By : Al Zoabi Baker
How do I alias a template specialization?
How do I alias a template specialization?
hope this fix your issue decltype() is a built-in operator, not a function from the std namespace like std::declval().If you want to shorten the syntax with an alias template, you can declare one as shown below:
TAG : cpp
Date : November 17 2020, 01:00 AM , By : mr.anime northview
Qt ASSERT failure in QList<T>::at: "index out of range
Qt ASSERT failure in QList<T>::at: "index out of range
I wish this helpful for you I think I have managed to reproduce your issue.in on_comboBox_Tabel_Select_currentIndexChanged there is a line:
TAG : cpp
Date : November 16 2020, 06:23 AM , By : Luis Alberto Amara
Qt system tray icon disappears when menu opened on OSX 10.10
Qt system tray icon disappears when menu opened on OSX 10.10
it should still fix some issue I have simple qt code: , This is Qt 5.4 bug:
TAG : cpp
Date : November 16 2020, 06:23 AM , By : Hynqueen Perez
UDP Socket error 10049
UDP Socket error 10049
I hope this helps . You're passing a pointer to the SOCKADDR_IN structure as third argument to inet_pton, but if you follow the link to the MSDN reference of the function you will see that it wants an IN_ADDR structure.The SOCKADDR_IN structure has s
TAG : cpp
Date : November 16 2020, 06:23 AM , By : user2949158
Having trouble implementing photon mapping
Having trouble implementing photon mapping
wish helps you First, thanks a lot for all your help.Second, I'm here to announce that after some trouble and after a period in which I didn't touch the code, I finally got it.
TAG : cpp
Date : November 16 2020, 06:23 AM , By : user2949075
Linux, execve how to run a child binary and pass payload efficently?
Linux, execve how to run a child binary and pass payload efficently?
will help you The advantage of your file-approach is that it is non-volatile and the data can be easily distributed around the globe as file. Based on your thought about pipes, I assume your "distributed computing" is on the same node. You could also
TAG : cpp
Date : November 16 2020, 06:23 AM , By : user2949064
Recursive function does not return specified value
Recursive function does not return specified value
will be helpful for those in need You're not using the return value of the recursive call. You need to do:
TAG : cpp
Date : November 15 2020, 06:54 AM , By : Connor Johnson
Use std::swap between vectors or vector::swap?
Use std::swap between vectors or vector::swap?
I wish this help you You should not use std::swap() directly in any case! Instead, you should use something like this:
TAG : cpp
Date : November 15 2020, 06:54 AM , By : Lamb42
Which macro is more exact? __TIME__ or __TIMESTAMP__?
Which macro is more exact? __TIME__ or __TIMESTAMP__?
around this issue I have the following little program: , The two macros do entirely different things: GCC
TAG : cpp
Date : November 15 2020, 06:54 AM , By : Thomas
What do the certain files do after creating an empty project in Visual Studio 2012?
What do the certain files do after creating an empty project in Visual Studio 2012?
this will help You should care about all of them, if you are working in Visual Studio. You can delete folders named Debug, Release, or ipch and they will be regenerated, as all files in them are derived from other files in your project.
TAG : cpp
Date : November 15 2020, 06:54 AM , By : Degila Arolde
Nested DirectConnection Signals are causing a segfault
Nested DirectConnection Signals are causing a segfault
hope this fix your issue I found a satisfying explanation here. Apparently, emitting a signal of type DirectConnection is equivalent to a direct function call. So the GUI is after all updated on a Worker thread when both signals are DirectConnect-ed.
TAG : cpp
Date : November 15 2020, 06:54 AM , By : Spencer Bass
Using localtime_s to create a timestamp? And using asctime_s. C++
Using localtime_s to create a timestamp? And using asctime_s. C++
this one helps. The first problem is you are not passing enough arguments to localtime_s. It requires two arguments but you are only passing one. The first argument should be a pointer to tm and the second a pointer to a time_t. The second problem is
TAG : cpp
Date : November 15 2020, 06:54 AM , By : user2948827
Calculating Vertex Normals for GL_TRIANGLE
Calculating Vertex Normals for GL_TRIANGLE
this will help I'm printing a triangle in OpenGL like this : , You need to calculate cross product of 2 edges vectors.
TAG : cpp
Date : November 15 2020, 06:54 AM , By : user2948680
Array Size Declaration issue
Array Size Declaration issue
wish of those help The number of elements of the array, the array bound, must be a constant expression.You have to use
TAG : cpp
Date : November 14 2020, 04:51 PM , By : rsxjan
Transforming recursive DFS-based topological sort into a non-recursive algorithm (without losing cycle detection)
Transforming recursive DFS-based topological sort into a non-recursive algorithm (without losing cycle detection)
To fix this issue Obviously, you'd use a stack but you wouldn't put all adjacent nodes anyway: that would yield a DFS with the wrong size complexity anyway (it would be quadratic in the number of nodes assuming non-parallel edges, otherwise potential
TAG : cpp
Date : November 14 2020, 04:51 PM , By : user2948635
caffe.cpp RegisterBrewFunction
caffe.cpp RegisterBrewFunction
will help you Your define defines a macro that can be used inside a function. When the code reaches this function then the macro argument will be registered. You have to call the function for brewing the coffee.The original define defines a macro tha
TAG : cpp
Date : November 14 2020, 04:51 PM , By : wacker2k
What do the words "undefined" mean in bullet point §5.19/2.3 in N4140?
What do the words "undefined" mean in bullet point §5.19/2.3 in N4140?
will help you This bullet was added by defect report 699 and it requires that a constexpr function or constructor must be defined before use. The defect report added the following example to 7.1.5 to demonstrate the rule:
TAG : cpp
Date : November 14 2020, 04:51 PM , By : dmm
Compiling Boost MPL samples on MSVC 2013
Compiling Boost MPL samples on MSVC 2013
I think the issue was by ths following , Basically there's a whole slew of missing headers. The last, simplest, one just misses
TAG : cpp
Date : November 14 2020, 04:51 PM , By : user2948566
osx - Linking error, when building POCO library
osx - Linking error, when building POCO library
it should still fix some issue Well, my solution is to put -stdlib flag to build/config/Darwin-clang and configure build with required Darwin-clang config.
TAG : cpp
Date : November 14 2020, 04:51 PM , By : Francesco Craparo
How to link main.cpp, a.h and a.cpp?
How to link main.cpp, a.h and a.cpp?
This might help you x is defined in two translation units (because the defining header is included by two cpp files). Define it only once:main.cpp:
TAG : cpp
Date : November 14 2020, 04:51 PM , By : mschwanzer
Why does using std::forward on an rvalue reference cause destruction of the object being referenced?
Why does using std::forward on an rvalue reference cause destruction of the object being referenced?
Hope this helps It is not destroyed, it is moved from. There is a big difference. Your use of std::forward is also totally incorrect, just FTR.In this case, std::forward is equivalent to std::move, which means that ptr is moved into the function. A m
TAG : cpp
Date : November 14 2020, 04:51 PM , By : tslpdsgn
Cannot release Device Context, HWND, and cannot unregister Windows Class(OpenGL) -
Cannot release Device Context, HWND, and cannot unregister Windows Class(OpenGL) -
this one helps. Probably KillGLWindow is called more than one time, and its not really proper, try this:
TAG : cpp
Date : November 14 2020, 04:51 PM , By : user2948510
Change last line in QTextBrowser
Change last line in QTextBrowser
it should still fix some issue Here is my solution, but mind you that it requires C++11 and Qt 5.4 at least to build and run. However, the concept is there that you can copy and paste out without using QTimer requiring those versions above:main.cpp
TAG : cpp
Date : November 14 2020, 04:51 PM , By : Salim Giunyet
Overload -> operator to forward member-access through Proxy
Overload -> operator to forward member-access through Proxy
Any of those help I'm trying to wrap a Python PyObject* in an Object class. In Python, everything is a PyObject*. A list is a PyObject*, and each item in the list is itself a PyObject*. Which could even be another list. etc. , If you can change Objec
TAG : cpp
Date : November 14 2020, 04:51 PM , By : user2948353
How to link libgomp statically when linking other libraries dynamically?
How to link libgomp statically when linking other libraries dynamically?
This might help you I am trying to build an image processing program written in C++ that depends on the following libraries using MinGW + MSYS (with GCC4.8.1) that I downloaded from www.mingw.org/ on a Windows 8 64bit computer , To link libgomp stati
TAG : cpp
Date : November 14 2020, 04:48 PM , By : user2948294
Stopping async_connect
Stopping async_connect
should help you out There's nothing elementary wrong with the code, and it does exactly what you desire on my Linux box:
TAG : cpp
Date : November 14 2020, 04:48 PM , By : user2948243
Why am i getting this template compile error?
Why am i getting this template compile error?
wish helps you You never define how an Employee should be outputed.Just implement the following function and you will be good!
TAG : cpp
Date : November 14 2020, 04:48 PM , By : user2948225
string concatenation using streams returns junk
string concatenation using streams returns junk
Hope this helps The char pointer returned by string::c_str() is only valid for the lifetime of the string (and only when it is not modified).But stream.str() returns a temporary string object, which you need to store somewhere. Otherwise it will be d
TAG : cpp
Date : November 14 2020, 04:48 PM , By : user2948218
Is a local class dependent if declared within a function template?
Is a local class dependent if declared within a function template?
wish help you to fix your issue According to my understanding (and the current wording of the standard), C in your example is not dependent. Neither is A::Type, so the typename is not required.There is a fundamental difference between nested classes
TAG : cpp
Date : November 14 2020, 04:48 PM , By : user2948210
assembly output of a simple C++ program
assembly output of a simple C++ program
Does that help I am trying to understand the assembly output of a simple c++ program. This is my C++ program. , Well, here it is line by line...
TAG : cpp
Date : November 14 2020, 04:48 PM , By : Håvard Nordlie Mathi
C++ - Which are variable by " Uint "?
C++ - Which are variable by " Uint "?
wish of those help Which are variable by " Uint "? is that there are " Uint8 ", " Uint16 ", etc ... , uint is not a standard type. On some system uint is typedefed as
TAG : cpp
Date : November 14 2020, 04:48 PM , By : hana
valgrind: errors with cvCvtColor in opencv
valgrind: errors with cvCvtColor in opencv
this will help please, avoid all deprecated IplImages, and use cv::Mat, and the c++ api instead.
TAG : cpp
Date : November 14 2020, 04:48 PM , By : user2948060
Iterator for jumping between container C++
Iterator for jumping between container C++
I think the issue was by ths following , Let's focus on a const iterator. Such an iterator should hold an iterator to each of the deques, but also to each of their end (why you need this is explained below). But these iterators should be held in a ve
TAG : cpp
Date : November 14 2020, 04:48 PM , By : user2948035
Use different parameter data types in same function? (C++)
Use different parameter data types in same function? (C++)
I wish did fix the issue. just create functions with the same name but with different parameters, this is called function overload, for example:
TAG : cpp
Date : November 14 2020, 04:48 PM , By : لزهر جلمي

shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org