C++ on Stack Overflow and Game Dev

1 answer

Odd behavior of std::vector back()

The following code asserts in the indicated place with "iterator+offset is out of range." void Network::PushInput(int c, int h, int w) { Input* input = new Input(batch, c, h, w, data); ...

1 answers | 3 mins ago by Walt Donovan on Stack Overflow stackoverflow.com
1 answer

c++ passing function to function

I've got class funciton Find. This function have to accept some variables and sometimes (pointer to) another function which will be used inside. How I should declare it? class CRoute { ... ...

1 answers | 4 mins ago by Dmitriy on Stack Overflow stackoverflow.com
0 answers

any efficient way to search the a number (equal, less than, greater than) from a sorted array?

Given an array of sorted numbers, and a number to search for and a condition such as LessThan, greater than, less than and equal, greater than and equal, and etc, return the match if it exists. and ...

1 answer

Using private nested type as parameter

I'm getting this strange problem which I don't know why happens. The first and second of the following code snippets compile, while the third does not: Compiles: class Foo { public: Foo() { ...

1 answers | 7 mins ago by Zizheng Tai on Stack Overflow stackoverflow.com
0 answers

Is there any reason why I shouldn't use function objects instead of functions?

I've been trying to teach myself how to program by working through the book Programming: Principles and Practice Using C++ by Bjarne Stroustrup and I recently learned about function objects, the way ...

0 answers

c++ fix give the number of days in month with a given year

i wroth a program in borland 4.52 that when i give the month number and the year return for me the days number of that month #include<iostream.h> #include<conio.h> void main() { clrscr(); ...

0 answers

Use Clang to convert C++ to C code

I know that llvm can be used to convert c++ into c code. I was wondering if clang could do the same thing (seeing as clang was derived from llvm). So can I use clang to convert c++ code into c code? ...

0 answers

This code always returns Image not loaded, is the path correct .this is opencv in android NDK

JNIEXPORT jstring JNICALL Java_com_weiss_konrad_arrowapp_NDKInterface_getID(JNIEnv *env, jobject o ){ Mat img = imread("storage/emulated/0/DCIM/Camera/IMG_20160506_141333.jpg"); ...

1 answer

Detect Windows Kit 8.0 and Windows Kit 8.1 SDKs

I'm working on a test script for Windows Tablets, Windows Phones and Windows Store apps. The scripts are mostly working for under Visual Studio 2012 and Windows Kit 8.0 SDK. It appears Microsoft ...

1 answers | 15 mins ago by jww on Stack Overflow stackoverflow.com
4 answers

Untying Knuth's knots: how do you restructure this spaghetti code?

This is a prequel, and serves as a motivating example to the question How to transform a flow chart into an implementation? which asks about ways of algorithmically eliminating the goto statement from ...

1 answer

function template overload resolution with user defined conversion operator

What is the correct output for following code according to C++11 standard? #include <iostream> template <typename X> class A { public: A() { std::cout << "A::A" ...

2 answers

Digital Sum and Sort Implementation

I am given a = [13, 20, 7, 4] array of integers and I am trying to write a digitalsumandsort(a) = [20, 4, 13, 7] function as shown. If two numbers have the same sum of digits, the smaller one (in the ...

3 answers

How to read a json file into a C++ string

My code like this: std::istringstream file("res/date.json"); std::ostringstream tmp; tmp<<file.rdbuf(); std::string s = tmp.str(); std::cout<<s<<std::endl; The output is ...

3 answers | 31 mins ago by aiziyuer on Stack Overflow stackoverflow.com
1 answer

Managing the program version with Jenkins, build number and svn revision

We are currently using Jenkins for CI. I chose Jenkins as we are deploying many programs on many different platforms (linux, windows, embedded systems.). This helps us a lot but we have difficulties ...

1 answers | 34 mins ago by Zyend on Stack Overflow stackoverflow.com
1 answer

How to connect to an unix domain socket with boost::asio?

I want to create and connect to an unix domain socket of type SOCK_SEQPACKET by specifying the path name of the socket endpoint, but this fails to compile in boost::asio v1.60: using namespace ...

1 answers | 35 mins ago by Martin on Stack Overflow stackoverflow.com
2 answers

How to marshal a structure in .NET to be used by native code?

I'm trying to write a DLL in .NET that can be called from a C++ executable. The executable expects a specific DLL to exist in its folder and expects a specific function name to be exported for it to ...

2 answers | 37 mins ago by tolsen64 on Stack Overflow stackoverflow.com
0 answers

Arguments to program vs stdin in Linux

In my work I am faced with a .exe program in Linux (C++ and openSUSE 11.4). In the running bash script there I found part of software, which was not so important to the global problem: echo "command ...

41 mins ago by grzes on Stack Overflow stackoverflow.com
1 answer

How to resolve the issue in RemoveAStud() not removing the node and crashes

template<class theType> newStudent<theType>* StudentList<theType>::getLocationOfID(const int & target, ...

1 answer

Nested class include header

I have a class that looks like this: // List.hpp template<typename T> class List { ... private: class Node; }; And I want to put the full definition of List<T>::Node into a ...

1 answers | 42 mins ago by Zizheng Tai on Stack Overflow stackoverflow.com
2 answers

create object with parameters on stack

this is not working for me in the header file of MainWindow: Form<int> form(5); compiler tells me expected identifier before numeric constant. So how do i create this object on stack in the ...

2 answers | 44 mins ago by Ini on Stack Overflow stackoverflow.com
2 answers

How to call a C++ delegated function from C#, when C++ call C# functions?

I would like to call a C# library from C++. The C# library, request a delegated function, in order to report the results. Maybe my purpose is confusing: the conception is, C++ call C# function, and ...

2 answers | 45 mins ago by Gaiger Chen on Stack Overflow stackoverflow.com
1 answer

How come disassemblies for x86 show registers for the x64 platform?

The code below has undefined behavior. That's the reason why I was trying to see the assembly (x86) for the code. I was surprised with the presence of registers like rbp, rsp, rax, rdi instead of ebp, ...

0 answers

convert formal argument to local variable in LLVM

I am doing a project on LLVM. I'm trying to make a pass: For a function, if the arguments(parameters) are constants, it will make a new function that the constants are converted to a local ...

0 answers

Change CRC32 to MD5 compare

some time ago i wroted a crc32 check files . Firse i need to find crc32 from file x and save it intro c++ source. When program start function need to compare crc32 saved in functions and compare with ...

51 mins ago by Ramy on Stack Overflow stackoverflow.com
1 answer

boost day_clock::local_day() conundrum

I have this piece of code which executes on a machine in Frankfurt: //hardcoding for simplicity but these get passed int year = 2016; int month = 05; int day = 6; ...

1 answers | 57 mins ago by user2930006 on Stack Overflow stackoverflow.com
3 answers

Can a std::function member have access to other members?

I am making a small tower defence game in order to practice C++. I know other languages, but have done little actual development in C++. In this game I'll have several buildings, so I made a class ...

3 answers | 1 hour ago by Istarnion on Stack Overflow stackoverflow.com
1 answer

CPLEX time until first feasible solution

I'm a beginner in CPLEX and C++ programming, and I'm trying to solve a medium size MIP problem. My issue is that I need to know how much time CPLEX took to get the first feasible solution and to get ...

1 answers | 1 hour ago by Javier on Stack Overflow stackoverflow.com
1 answer

VS build successful regardless of code

I'm creating a C++ library in Visual Studio 2015. The project builds "successfully" when it clearly shouldn't. For example it builds if I type garbage into a source file. I would like to be warned ...

1 answers | 1 hour ago by matt_rule on Stack Overflow stackoverflow.com
1 answer

How to get a polygon from boost::geometry::model::polygon?

I'm trying to calculate a difference of two polygons using boost::geometry::difference with boost::geometry::model::polygon representing my polygons. In case when the first polygon contains the ...

0 answers

how to plot a color map or countour plot using QT in visual studios

I have a file that is the pixels in percentage of an image I placed the info in a double vector using this code: for (int j = 0; j < 301; j++) { cout << "\n"<<"\n"; for (int i ...

15 30 50 per page
1 2 3