iOS Clang -std -stdlib options c++11 error

I have an iOS project set up like this: I use XCode 6.1.1 clang -v says LLVM version 6.0 I use the flag -miphoneos-version-min=6.1 (I don't set -std and -stdlib) Everything's fine. When I update to -miphoneos-version-min=7.1 I have following err...
more »

2017-01-16 17:01 (0) Answers

C++ sort with 'tweaked' compare functor

I have a class functor (too complex to implement as a lambda), but to strip the idea down, I want to ensure the functor satisfies the Compare predicate. The issue is, I want all values larger than (1) to yield ascending order, but to place all values...
more »

2017-01-07 05:01 (1) Answers

Binding generic callbacks with arguments c++11

I have a class called Renderer that holds two callback objects; void (*drawCall)(const sf::Drawable& drawable, const sf::RenderStates& states); void (*drawPrimCall)(const sf::Vertex* vertices, unsigned int vertexCount, sf::PrimitiveType ...
more »

2017-01-06 14:01 (2) Answers

std::sort algorithms memory usage

I'm wondering whether the standard libraries sorting algorithms (e.g. std::sort) are using the heap memory for sorting. Is there any reliable source how to find out what kind (heap, stack) and how much of temporary memory is used by a sorting algor...
more »

2017-01-05 00:01 (1) Answers

Class Template Errors , Linked Lists

I am trying to create an unordered Linked List and the textbook that I am using says that a linked list iterator class is needed before creating the linked list ADT. Ultimately it will be a functional linked list that can print in reverse, split at a...
more »

2017-01-03 17:01 (0) Answers

Using too many functions

I'm reading a book in which a window class' constructor doesn't initialize all the implementation directly, instead it calls a function that calls another etc... e.g. window::window(T&t, X&x) { setup(t, x);} void window::setup(T&t, X&a...
more »

2017-01-03 16:01 (2) Answers

C++ sort cannot sort set of strings?

I am wondering how I can sort a set that contains strings. For example, I have a set: std::set<std::string> setA = {"B","A","C"} Then I wanna use this to do the sorting: std::sort(setA.begin(),setA.end()); But the C++ compiler cannot let ...
more »

2017-01-01 17:01 (3) Answers

Difference between f and &f

Consider the code: void f(int) {} int main() { std::function<void(int)>func = f; func(3); std::function<void(int)>funcc = &f; funcc(3); void(*ptr)(int) = f; ptr(3); void(*ptrr)(int) = &f; ptrr(3)...
more »

2016-12-25 10:12 (0) Answers

How to make qtcreator work with c++11

I am trying to make school project works locally, but I keep having trouble with qtcreator and c++11. The compilator keeps saying it can't use c++11 stuffs: /Users/yoong93/Qt5.6.2/5.6/clang_64/lib/QtCore.framework/Headers/qstring.h: 757: error: no ...
more »

2016-12-24 09:12 (1) Answers

Passing unique_ptr<int[]> to a function

#include <iostream> #include <memory> std::unique_ptr<int[]> addElement(int *myNumbers, int sizeOfArray); void printArray(int * arr_ptr, int sizeOfArray); int main() { const int SIZE = 5; int myNumbers[SIZE] = {18, 27, 3, ...
more »

2016-12-05 00:12 (1) Answers

Use a lambda as a parameter for a C++ function

I would like to use a lambda as a parameter for a C++ function, but I don't know which type to specify in the function declaration. What I would like to do is this: void myFunction(WhatToPutHere lambda){ //some things } I have tried void myFun...
more »

2016-11-28 13:11 (3) Answers

C++ Is "class Name*" a class pointer?

I was watching an unreal tutorial and encountered this line of code: class UStaticMeshComponent* Pickup; It is a forwards declaration. I have been studying c++ for a while and have not encountered anything like this before. I know about pointers ...
more »

2016-11-25 20:11 (2) Answers

Sorting bidimensional arrays by column using STL

In this question, we see a good explanation how sort vectors by the first element of each vector and a second example going through each vector and sort by it's elements. I know that arrays are not the first class citizens of C++ for power users of...
more »

2016-11-17 11:11 (1) Answers

Transform c++ class private variables to public

I am a first year student of programming, and I need some help. I have code with public class but I need to change public to private. And it doesn't work for me. Maybe somebody can help me with some suggestions? Here's my working code with public obj...
more »

2016-11-16 22:11 (2) Answers

ASC_REQ_CONNECTION need clarification

https://msdn.microsoft.com/en-us/library/windows/desktop/aa374708(v=vs.85).aspx ASC_REQ_CONNECTION The security context will not handle formatting messages. can somebody clarify what does it mean? I found strange problem: if I set this value on cl...
more »

2016-11-16 17:11 (0) Answers