logo
down
shadow

CPP QUESTIONS

passing array from one function to the other
passing array from one function to the other
should help you out Two issues:1) The array is not initialized to contain 55 zeros, but only 1, remaining 54 elements are going to be some older memory content:
TAG : cpp
Date : November 08 2020, 09:00 AM , By : Phương Mai
Parsing XML file with RapidXML - only parsing first line of files
Parsing XML file with RapidXML - only parsing first line of files
Does that help You're confusing XML attributes and elements. Attributes would look like this:
TAG : cpp
Date : November 08 2020, 09:00 AM , By : seg
The lifetime of a temporary to which several references are bound in C++
The lifetime of a temporary to which several references are bound in C++
it helps some times This is a defect in that section that I reported as http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html1299 .The proposed resolution is to add a term "temporary expressions". Life-time extension only happens for objects re
TAG : cpp
Date : November 07 2020, 01:43 PM , By : Paulo Ricardo
Memory hack to transpose matrix corrupts stack, C++
Memory hack to transpose matrix corrupts stack, C++
With these it helps Your subscripts (or loop limits) were backwards where you initialized the matrices.You have
TAG : cpp
Date : November 07 2020, 01:43 PM , By : flannerc
clang vs gcc run-time difference: c++ class template built w clang crashes w/o copy constructor, built w gcc crashes wit
clang vs gcc run-time difference: c++ class template built w clang crashes w/o copy constructor, built w gcc crashes wit
hop of those help? Would does the following code crash during run-time when built with clang (but not gcc) unless I include a copy constructor for the TableTypeCarrier template class? If I include that copy constructor why do I experience the same ru
TAG : cpp
Date : November 07 2020, 01:43 PM , By : Mary
how to get property create in derived class using a pointer to based class c++
how to get property create in derived class using a pointer to based class c++
Any of those help You can use a pure virtual function declaration in the base and then you don't have to provide a body for the function, though you still can.
TAG : cpp
Date : November 07 2020, 01:43 PM , By : Daedalus
Wrong answer in UVa online judge
Wrong answer in UVa online judge
Hope this helps You have not read the complete question.Correct solution is as follows:
TAG : cpp
Date : November 07 2020, 01:43 PM , By : Tommaso
QThread with slots and signals does not seem to create a new thread
QThread with slots and signals does not seem to create a new thread
help you fix your problem Your using QThread wrong. By just creating the thread, it will not execute on the thread. you will need to do it inside the QThread::run function (by overriding it), since thats the only one that will run on the new thread.
TAG : cpp
Date : November 07 2020, 01:33 PM , By : KyleMac
Convert SSE matrix-vector multiplication code to AVX
Convert SSE matrix-vector multiplication code to AVX
around this issue Unfortunately using horizontal adds like that does not trivially extend to 256 bit, because the instruction (and most others) is "laned" - it acts like two haddps's in parallel, one on the top half and one on the bottom half, with n
TAG : cpp
Date : November 07 2020, 01:33 PM , By : shah
Inherited class memory leak
Inherited class memory leak
it helps some times I created this pattern in the project I'm working on: , You forgot do define virtual destructor in Base struct:
TAG : cpp
Date : November 07 2020, 01:33 PM , By : Alec Edwards
Sharing a vector across multiple functions and my program isn't working as intended.
Sharing a vector across multiple functions and my program isn't working as intended.
should help you out The program is making a full copy of the vector. That means that the version in each function is independent.
TAG : cpp
Date : November 07 2020, 01:33 PM , By : Sean Matlock
Boost asio - separate different chunks of data
Boost asio - separate different chunks of data
To fix the issue you can do Imagine we create simple client-server app to send files from client to server. We use boost asio. , First idea I have is to use special delimiter.
TAG : cpp
Date : November 07 2020, 01:33 PM , By : Anand
C++ Cutting Rod Dynamic programming
C++ Cutting Rod Dynamic programming
I wish did fix the issue. The best way to avoid issues like this is to define variables for the dimensions in the first place. For example,
TAG : cpp
Date : November 07 2020, 01:33 PM , By : Willusky
VS2015 rejects in-class initialization in unnamed type
VS2015 rejects in-class initialization in unnamed type
Hope that helps This code is perfectly fine and it compiles with VS2015 Update 1 RC (just verified). Maybe you're missing something . The system on which I tested :
TAG : cpp
Date : November 07 2020, 01:33 PM , By : Yuko
How do I do the following recursive function?
How do I do the following recursive function?
seems to work fine In C++ there is no concept of left-to-right (or right-to-left) evaluation order of expressions. Operator priorities will control associativity, but in the case of f1() + f2() there is no guarantee that f1() is invoked before f2() (
TAG : cpp
Date : November 07 2020, 01:33 PM , By : Fineas Gavre
Rotate Camera With Quaternions
Rotate Camera With Quaternions
wish of those help After a few days of trying all sorts of different things I found the problem. I forgot that Quaternions are non-commutative when multiplied. This was causing the camera to rotate in weird ways. So to fix the problem all I had to do
TAG : cpp
Date : November 07 2020, 01:33 PM , By : reflextandem
using std::unique_ptr with allocators
using std::unique_ptr with allocators
To fix this issue I was trying my hand with allocators this time felt that there were many chances of leaking the resources. So I thought what if I used std::unique_ptr to handle them. I tried my hand with a std::vector's allocator. My code goes lik
TAG : cpp
Date : November 07 2020, 01:33 PM , By : Ali Karooni
suitability for stringstream in parsing text files
suitability for stringstream in parsing text files
this will help I think the suitability of Spirit depends on the size of your project. If it's a small lexer and parser then it may not make sense. But if it's a complicated language, it will make sense since you can worry about implementing the funct
TAG : cpp
Date : November 07 2020, 01:33 PM , By : Josh Betz
Filtering a tuple with an integer_sequence
Filtering a tuple with an integer_sequence
I wish did fix the issue.
TAG : cpp
Date : November 07 2020, 01:33 PM , By : BabySpook
Application compiled with VS2013 wants VS2005 runtime
Application compiled with VS2013 wants VS2005 runtime
I wish this help you Thank you for all, you was right. I just forgot, that I have installed old version of my product. It was launched in background and used old versions of libraries. So when I ran my new application it tried to use libraries that a
TAG : cpp
Date : November 07 2020, 01:32 PM , By : Terry Spence
Does accessing arrays slow down my function?
Does accessing arrays slow down my function?
Does that help The question what creates the difference between the execution times of your two functions really cannot be answered without knowing either the resulting assembler code or which of the globals you are accessing are actually constants t
TAG : cpp
Date : November 07 2020, 01:32 PM , By : Alex
why copy constructor use private property directly in C++
why copy constructor use private property directly in C++
around this issue Look at following: , It won't compile, because your function is not declared const:
TAG : cpp
Date : November 07 2020, 01:32 PM , By : Camille Gunning
Find largest element in matrix and its column and row indexes using SSE and AVX
Find largest element in matrix and its column and row indexes using SSE and AVX
will be helpful for those in need Here's a working SSE (SSE 4) implementation that returns the max val and corresponding index, along with a scalar reference implementation and test harness:
TAG : cpp
Date : November 07 2020, 01:32 PM , By : Philippe Gevaert
Check for data with timing?
Check for data with timing?
like below fixes the issue You just need to attempt to read.The usual approach is to define deadlines for all asynchronous operations that could take "long" (or even indefinitely long).
TAG : cpp
Date : November 07 2020, 01:32 PM , By : Peter
Most efficient way to check for messages in array
Most efficient way to check for messages in array
I wish this helpful for you For now I have gone with making a static class which has a queue. I use this class to send messages from the BoardSquare to the Gameboard. (Making a static class might not be the "best" solution in long term goals but sinc
TAG : cpp
Date : November 07 2020, 01:32 PM , By : Justinas
Eigen and lazy evaluation
Eigen and lazy evaluation
may help you . For all coefficient-wise operations, the answer is yes. However, matrix products are special because, for efficiency reasons, they are by default evaluated within temporaries. You can enforce lazy evaluation of a matrix product using l
TAG : cpp
Date : November 07 2020, 01:32 PM , By : skout
Why Isn't find_one working in MongoDB C++?
Why Isn't find_one working in MongoDB C++?
this will help The bsoncxx library has two document types, views and values. A document::value contains the actual document data, and a document::view is just a reference to some underlying value. Values must outlive the views that use them.There's a
TAG : cpp
Date : November 07 2020, 01:32 PM , By : Jesper Holde
Do I need the Qt toolchain to target a library built with Qt?
Do I need the Qt toolchain to target a library built with Qt?
around this issue Is is necessary to use the Qt tools in order to link against a library that was implemented with Qt.
TAG : cpp
Date : November 07 2020, 01:32 PM , By : Maiko Kingma
Prevent implict object construction from bool?
Prevent implict object construction from bool?
Hope this helps This happens because bool is a better match for const char[] than std::string. When you have no ctor accepting bool then the std::string one is chosen. When you have a ctor with bool then this overload is selected. Only it is deleted
TAG : cpp
Date : November 07 2020, 01:32 PM , By : Robbb
C++ recursive function with float variable
C++ recursive function with float variable
To fix this issue Consider the following code: , In these lines
TAG : cpp
Date : November 07 2020, 01:32 PM , By : Navneeth Talasu
SEGFAULT in -O3 mode?
SEGFAULT in -O3 mode?
wish of those help The source of SEGFAULT was not solely in violation of the strict aliasing rule, as the problem persisted even with -fno-strict-aliasing flag.It was indeed accessing unaligned memory, but not as simple as that. As modern processors,
TAG : cpp
Date : November 07 2020, 01:32 PM , By : amil
CMake Boost 1.59.0 geometry
CMake Boost 1.59.0 geometry
it should still fix some issue COMPONENTS is required only for built libraries. Geometry is an header-only library so it's not needed. You need only to find the boost headers location.
TAG : cpp
Date : November 07 2020, 01:32 PM , By : Lavlesh Kumar
C++ constructor error: Matrix Class, cannot initialize array of matrices
C++ constructor error: Matrix Class, cannot initialize array of matrices
wish of those help While I do agree with others that the error you are getting explains your situation, I do not agree with the harsh downvoting. The actual problem here seems to be that you want to initialize and array of objects using non default c
TAG : cpp
Date : November 07 2020, 09:00 AM , By : Danal Meizantaka Dae
how I can compile templates c ++ 11, I can c ++ 14
how I can compile templates c ++ 11, I can c ++ 14
will be helpful for those in need Remove include "ar.cpp" from main. You're defining insert two times.There is no difference between the relevant rules in C++11 and C++14. You did something different between your test runs that has nothing to do with
TAG : cpp
Date : November 07 2020, 09:00 AM , By : Yoanes Richard
How can I call a function using parameter list in c++?
How can I call a function using parameter list in c++?
this will help You can create an overloaded function that takes the paramlist object, and extracts the items to call the proper foo function with its actual arguments.
TAG : cpp
Date : November 07 2020, 09:00 AM , By : Eyal Ringort
My c++ program return a weird output
My c++ program return a weird output
Hope this helps 'nDigits=' is a multi-character character constant.When it is written in hex using ASCII code, it becomes 6E 44 69 67 69 74 73 3D, and 1769239357 is equal to 0x6974733D.
TAG : cpp
Date : November 07 2020, 09:00 AM , By : Leonardo T
Meaning of phrase "constructors do not have names" in the C++ Standard
Meaning of phrase "constructors do not have names" in the C++ Standard
hope this fix your issue Your intuition is correct. This is a known Clang bug 13403 with status NEW.
TAG : cpp
Date : November 07 2020, 09:00 AM , By : saleha muqaddas
Base Class Pointer doesn't see members of Derived
Base Class Pointer doesn't see members of Derived
it should still fix some issue Inheritance goes in the other direction. A pointer to a Derived object can see Base members, but a pointer to Base cannot see Derived members. There is no virtual for data members, and even for functions it would be vir
TAG : cpp
Date : November 07 2020, 09:00 AM , By : acphire
Creating a dynamic array seems to cause program termination
Creating a dynamic array seems to cause program termination
around this issue The crash is not in the line you have indicated.When you run this code through a compiler with a sufficiently high warning level, you will probably be shown a message like:
TAG : cpp
Date : November 07 2020, 09:00 AM , By : Mazharul Islam
How to pass values greater than std::numeric_limits<fundamental_type>::max() to a function?
How to pass values greater than std::numeric_limits<fundamental_type>::max() to a function?
Any of those help I am writing a function void func(K const val), which part of a template class. , Assuming the definition of your class foo is something like:
TAG : cpp
Date : November 07 2020, 09:00 AM , By : user4569238
Vector iterator -> Printing clases (missing argument)
Vector iterator -> Printing clases (missing argument)
I wish this helpful for you I am using VS V++ 2013. I have function that takes vector as parametar and prints out classes(I got abstract class, and few childs). I've done everything except printing. I have problems with vector iterator. I am getting
TAG : cpp
Date : November 07 2020, 09:00 AM , By : Hakim
Program does not proceed to console window
Program does not proceed to console window
Does that help You might have missed to use the linker flag SUBSYSTEM:CONSOLE. MSDN link
TAG : cpp
Date : November 07 2020, 09:00 AM , By : sagar
Sealing classes in C++ and virtual inheritance
Sealing classes in C++ and virtual inheritance
will be helpful for those in need For normal inheritance, the derived class's constructor only calls the constructors of the direct base classes. So in the first example, the constructor of FailsToDerive calls the constructor of Sealed, which in turn
TAG : cpp
Date : November 06 2020, 09:01 AM , By : Al.
Undefined references to swscale functions
Undefined references to swscale functions
it fixes the issue You're not showing your code, but typically the problem is that you need extern "C" around ffmpeg include statements when compiling c++ code (see FAQ):
TAG : cpp
Date : November 06 2020, 09:01 AM , By : Lecheunge
C++: How do I create a Shortcut in the Start Menu on Windows
C++: How do I create a Shortcut in the Start Menu on Windows
This might help you Here is the solution. It uses Qt but it's also possible without. Then just use std::wstring instead of QString. For concatenating the paths and filenames you will then have to use string operations instead of using QDir.
TAG : cpp
Date : November 06 2020, 09:01 AM , By : Raghav
How to bundle libstdc++.so.* correctly?
How to bundle libstdc++.so.* correctly?
wish of those help How to correctly locate libstdc++.so.* used to compile an autotools project, in order to bundle it with the distribution? , g++ -print-file-name=libstdc++.so
TAG : cpp
Date : November 06 2020, 09:01 AM , By : Nicolas.T.
OpenCV arrowedLine function
OpenCV arrowedLine function
I wish did fix the issue. The function arrowedLine is in: OpenCV 3.0: imgproc.hpp OpenCV 2.4.12, 2.4.11, 2.4.10 : core.hpp OpenCV
TAG : cpp
Date : November 06 2020, 09:01 AM , By : Dmitry Ashurov
A generic function in C++ to print 2D integer array, created by various techniques
A generic function in C++ to print 2D integer array, created by various techniques
To fix this issue I am looking for a function in C++ to print 2D integer array created by various mechanisms allowed in C++. Please refer the comments in the code I have pasted below for the different techniques I used to create 2D integer array. , M
TAG : cpp
Date : November 06 2020, 09:01 AM , By : ehabo saleh
c++ are two strings the same?
c++ are two strings the same?
it helps some times By calling cin.get(), you consume the first character from cin. You will need to store it somewhere and attach it to the result of getline.
TAG : cpp
Date : November 06 2020, 09:01 AM , By : pdes06
Class Template Errors
Class Template Errors
With these it helps You should put all code for template class Pair into the header file.Also, there is no need to separate method declaration from definition in header.
TAG : cpp
Date : November 06 2020, 04:03 AM , By : Simon Elder
What is the benefit to using a static library over including a header file?
What is the benefit to using a static library over including a header file?
help you fix your problem You have a false dichotomy in your question. A static library is not an alternative to a header. There are, off the top of my head, 3 alternatives to a static library. A dynamic library. A compiled library that is seperate f
TAG : cpp
Date : November 06 2020, 04:03 AM , By : shura_7_2
Need help on understanding Boost FAQ on header-only libraries
Need help on understanding Boost FAQ on header-only libraries
This might help you The FAQ entry has nothing to do with installing the Boost library on your system.The FAQ entry is for people who use Boost.Build as their build system (as opposed to make, CMake, etc). They observe that some libraries are header-o
TAG : cpp
Date : November 06 2020, 04:03 AM , By : jermel 4ever
Class Template C++ Errors
Class Template C++ Errors
With these it helps You've been bit by using namespace std;. You have your own pair class, but there's a std::pair in the standard library. The compiler can't decide which one to use, so you get an ambiguous symbol error.Solution: Don't use using nam
TAG : cpp
Date : November 06 2020, 04:03 AM , By : malraj dheeraj
What's the difference between the noexcept keyword and _NOEXCEPT macro?
What's the difference between the noexcept keyword and _NOEXCEPT macro?
Hope this helps _NOEXCEPT is not a standard macro. That's indicated by the leading underscore, which says this belongs to the implementation.Most probably this macro was defined as throw() until the Visual C++ compiler gained support for the noexcept
TAG : cpp
Date : November 06 2020, 04:03 AM , By : Atul Nair
Why is the "% for loops" comparably memory-expensive to the summation algorithm?
Why is the "% for loops" comparably memory-expensive to the summation algorithm?
wish help you to fix your issue I assume you are talking about this problem:https://www.hackerrank.com/contests/projecteuler/challenges/euler001
TAG : cpp
Date : November 06 2020, 04:03 AM , By : sqlito
how to register and use a hook in c++?
how to register and use a hook in c++?
Does that help 1.To obtain the index of a StandardHost from vector you should refer to the parent module of udpApp:
TAG : cpp
Date : November 06 2020, 04:03 AM , By : ceria agnantria
Error 34;Result is too long in socket programming
Error 34;Result is too long in socket programming
I hope this helps . In your server code you're calling recv() on the socket you passed to listen() and accept().accept() returns a socket representing the connected client. This is the socket you should pass to send() and recv().
TAG : cpp
Date : November 06 2020, 04:03 AM , By : Max
C++: Is there a way to define each element of a 2-D array as such:
C++: Is there a way to define each element of a 2-D array as such:
I hope this helps . So I was wondering if there is a way to define each element of a 2-D array similar to how you would define elements of a one dimensional array: , It's very simple dear. It goes like this :-
TAG : cpp
Date : November 06 2020, 04:03 AM , By : Rayanagouda Patil
How can i get a result in my Roman numeral to decimal converter?
How can i get a result in my Roman numeral to decimal converter?
it helps some times There are many errors in your program: constructor, destructor was missing in class rom2dec main function was not calling methods to do conversion if statements were wrong.
TAG : cpp
Date : November 06 2020, 04:03 AM , By : Duc Xoan
C++ How does this Syntax Work?
C++ How does this Syntax Work?
hope this fix your issue I'm reading through some source code, and I've found some wacky-looking code. Here is one example of a single function that's been declared an used, and this syntax has been used a lot.
TAG : cpp
Date : November 06 2020, 04:03 AM , By : amirz

shadow
Privacy Policy - Terms - Contact Us © animezone.co