r/cpp11 • • Aug 11 '14

Asynchronous lambda expressions in C++ 11: is ‘this’ still alive?

Thumbnail
rubentorresbonet.wordpress.com
1 Upvotes

r/cpp11 • • Aug 29 '13

Tuple Forwarding [xpost: r/cpp, credit to /u/meetingcpp]

Thumbnail
functionalcpp.wordpress.com
1 Upvotes

r/cpp11 • • Jan 27 '17

How to handle big datasets in c++?

2 Upvotes

I am writing some machine learning algorithms like neural nets and svm in C++ as a learning exercise. I need to handle a big dataset on my handwritten algorithm. How should I access and manage the data? I have heard about hdf5 and their c api. Is that something that can be used or should I use something else? My focus is something that is easy to use but that can be traded off for some technique that is super-scalable and an all-around much better idea to use. Please don't tell me about machine learning libraries, I know they are awesome, this is just a learning exercise. Thanks.

The dataset is around 20-30gb. I have 8gb ram available along with an nvidia 940mx gpu. I will use cuda for training. The dataset is text based and I need to do a classification task on it by training and testing and then predicting using the trained model. Please tell me what more details are needed.


r/cpp11 • • Jan 18 '16

Thread Affinity and Hyperthreading

Thumbnail
eli.thegreenplace.net
2 Upvotes

r/cpp11 • • Jun 20 '17

nullptr

Post image
6 Upvotes

r/cpp11 • • Jun 27 '17

You don't need a stateful deleter in your unique_ptr (usually)

Thumbnail
dev.krzaq.cc
4 Upvotes

r/cpp11 • • Feb 24 '19

Elevator simulation using cpp

Thumbnail
youtu.be
2 Upvotes

r/cpp11 • • Mar 24 '19

Nameof operator for modern C++, simple name of a variable, type, member, function, macros, and enum.

Thumbnail
github.com
3 Upvotes

r/cpp11 • • Apr 09 '19

[magic_enum]: Static reflection on enums for modern C++, work with any enum type without any macro or boilerplate code. Enum-to-string/String-to-enum and other useful functions.

Thumbnail
github.com
2 Upvotes

r/cpp11 • • May 01 '23

FUNCTIONS IN CPP | LEARNING CPP ONLINE

Thumbnail
guerillateck.com
1 Upvotes

r/cpp11 • • Jan 29 '15

Using Lambdas in MFC Applications - Part 1 [x-post from /r/codexpert/]

Thumbnail
codexpert.ro
2 Upvotes

r/cpp11 • • Feb 05 '13

constexpr question

1 Upvotes

I was tinkering around with constexpr to solve another redditor's question in a novel way and I noticed that the compiler was generating less-than-optimal code, depending on how I was applying the statement. This code adds all of the even numbers up to 100.

In the first instance, the compiler did what I expected:

#include <iostream>

template<int NUM> class Adder{
public:
    constexpr static int RUNNING_TOTAL = Adder<NUM-2>::RUNNING_TOTAL + NUM;
};

template<> class Adder<0>{
public:
    constexpr static int RUNNING_TOTAL = 0;
};

int main(int argc, const char * argv[])
{
    std::cout << Adder<100>::RUNNING_TOTAL<<std::endl;
    return 0;
}

And the compiler generated this (snippet):

movl	$2550, %ecx 

Here, it rolled up all of the loops and output the sum. Great. Unfortunately, when I removed the classes and used functional template specialization, like so:


#include <iostream>
template<int NUM> constexpr int getTotal(){return getTotal<NUM-2>() + NUM;}
template<>    constexpr int getTotal<0>(){return 0;}

int main(int argc, const char * argv[])
{
    std::cout << getTotal<100>() <<std::endl;
    return 0;
}

I end up getting this (snippet):

callq	__Z8getTotalILi100EEiv
movq	__ZNSt3__14coutE@GOTPCREL(%rip), %rdi

...

__Z8getTotalILi100EEiv:
callq	__Z8getTotalILi98EEiv
addl	$100, %eax

And this continues, one function calling another until the solution is reached at runtime.

Why isn't constexpr rolling up the loops in this case? Did I violate constexpr-ness somehow?

Weirdly, sometimes it does roll it up:


template<int NUM> constexpr int getTotal(){return getTotal<NUM-2>() + NUM;}
template<>    constexpr int getTotal<0>(){return 0;}

template<int N>
class Foo{
public:
    static constexpr int getNumber(){return N;}
};

int main(int argc, const char * argv[])
{
    //std::cout << Adder<100>::RUNNING_TOTAL <<std::endl;
    std::cout <<Foo<getTotal<14>()>::getNumber()<<std::endl;
    return 0;
}

Which gives me the following assembly:

__ZN3FooILi56EE9getNumberEv: 
movl	$56, %eax //<-- 56 is the right answer.
popq	%rbp
ret

[edit: Should note that I am using the Apple LLVM compiler 4.2.]

[edit 2: Incidentally, just typing getTotal<getTotal<3>()>() crashes my ide (xcode 4.6) consistently.]


r/cpp11 • • Mar 31 '16

Awesome Modern C++ (list of only high quality resources, help me make it even better)

Thumbnail
github.com
5 Upvotes

r/cpp11 • • Jun 11 '13

Extended Friend Declarations in C++11

Thumbnail
ibm.com
2 Upvotes

r/cpp11 • • May 30 '13

C++ auto and decltype Explained [x-post: /r/cpp; credit to /u/mttd]

Thumbnail thbecker.net
2 Upvotes

r/cpp11 • • Jun 16 '14

Better types in C++11

Thumbnail
cprogramming.com
3 Upvotes

r/cpp11 • • Mar 05 '13

The importance of std::function [xpost from cpp]

Thumbnail
probablydance.com
1 Upvotes

r/cpp11 • • Apr 14 '14

Runtime differences between C++03 and C++11

Thumbnail
stackoverflow.com
3 Upvotes

r/cpp11 • • Mar 21 '13

C++11 concurrency: locks revisited

Thumbnail codexpert.ro
2 Upvotes

r/cpp11 • • Mar 05 '13

C++11 concurrency: condition variables [xpost from /r/cpp]

Thumbnail codexpert.ro
3 Upvotes

r/cpp11 • • Apr 02 '13

Ten C++11 Features Every C++ Developer Should Use [x-post: /r/cpp, credit to /u/meetingcpp]

Thumbnail
codeproject.com
4 Upvotes

r/cpp11 • • Apr 14 '14

Converting between numbers and strings in C++11

Thumbnail codexpert.ro
4 Upvotes

r/cpp11 • • Feb 16 '14

Exploiting the delete specifier. [X-post: /r/cpp]

Thumbnail
cpp-today.blogspot.it
4 Upvotes

r/cpp11 • • Aug 28 '17

Property Binding Library C++

3 Upvotes

Hello I'm a student writing my masters degree and i got a thesis about researching and writing a property binding library for C++.

My question to you guys is:

  • What extra functionality would you like to have in such a library?

  • Do you have some tips for me and sources i should have a look into?

  • Special standards you think i should use? (at the moment it's only -std=c++11 and newer)