Dabbling in C++
My adventures in messing around with C++ and trying to explain it!
c++, boost, pointers
6 posts in this saga
Updated at Feb 28 2018 at 11:51 UTC
-
Started Dabbling in C++ again, so Let's Get Started.
1 of 6 |Updated at
I have not officially programmed in C++ for a long time though I did program C in successfully fixing and refactoring a python C module. I've been programming Java at work for a good amount of time now.
IDEs are the staple of any low level language for me, though I can survive without them. Just a little slower because the lack of autocomplete. Anyway, there are many build systems you can use for C++, but I think CMake is a good starting point if you want cross platform builds. The link below is a good way t... -
Dabbling in C++, Using Boost
2 of 6 |Updated at
To start off, I'm using a Mac and you know we have homebrew to install things, so lets use it to use boost in our C++ program.
To install homebrew:
Go to http://brew.sh/ and you follow the instructions to get it
Install boost:
`brew install boost`
Verify boost is installed:
`brew list | grep 'boost'`
Great, once it is verified now we need to include BOOST into our CMake project.
Open up CMakeLists.txt and make sure you have the below (USE C++ 14 PLS):cmake_minimum_required(VERSION 3.6)
project("PROJECT_NAME_HERE")
se...
-
Dabbling in C++, Template Metaprogramming Overview
3 of 6 |Updated at
When I used to hangout in IRC gamedev channels, template metaprogramming was that arcane and cryptic thing to me... It still is. Why would anyone use it anyway? How does it make life easier for me? The truth appears to be don't use it unless you have a really good reason, but that should not stop anyone from learning about it in case it is encountered while reading other code.
So why use it? If you've used Java, then you know ArrayList<Integer> is a dynamic collection of Integer objects. The equivalent in C+...
-
Dabbling in C++, Object Model
4 of 6 |Updated at
Just watch this: https://www.youtube.com/watch?v=iLiDezv_Frk and learn why C++ does what it does.
*Mic drop* -
Dabbling in C++, Modern Way of Pointers (Raw, Unique, Shared, Weak)
5 of 6 |Updated at
I am going to assume you know what pointers are for and why you use them. If not, please go learn about stack and heap memory.
If you are like me, you know raw pointers look like this: `int * someNumber`. You manage your own memory with `new` and `delete`. Manual memory management has its' benefits, but clearly it does not at a large scale given the amount of overhead people are willing to take to use garbage collected languages.
If you know about auto_ptr, forget about it. It is gone in C++17.
Unique, Shared... -
Dabbling in C++, Regular Expressions
6 of 6 |Updated at
As with any good student who learns by example and wants to do string pattern matching, we want figure out how easy is it to use regex in a particular language. It is so easy with c++ 11 and above or else resort to Boost's regex.
C++ guys basically took everything from Boost's regex. I wrote a test program using boost::regex_match with match results being stored in boost::smatch. To convert to C++11, all I had to do was substitute boost with std.
Links
- http://www.cplusplus.com/reference/regex/regex_match/