W

Wron

Just a curious programmer.

Daily Dose C++: Virtual Functions

Source Geeks For Geeks: Virtual Functions Dose Polymorphism achieved through runtime. Bound through using a pointer to a class object. Need to use the keyword virtual to enable usage of virtual function Since the derived object is related to the base object, you can pass a pointer to derived thorugh the base object. Regardless, the base object will know to use the derived object. class baseObject { public: // Note: virtual keyword used here for function. virtual void pri...
Read post

Daily Dose C++: Overload Comparison Operators

Wow, it has been a while since I wrote one of these. Need to find a way to incentivize myself on writing these as a habit. Anyways, let's talk C++. One neat thing I remember from my Data Structures class was C++ comparison operator overloads. Pretty cool way to express these comparisons without having to write out a function call every time. Say we have a custom class object to hold our data in. class customObject{ private: int someValue; int anotherValue; string someName; } ...
Read post

Daily Dose C++: std::endl

Source: C++ Weekly: Stop using std::endl CPP Reference endl CPP Reference flush The Dose: << std::endl; is the same as << "\n" << std::flush;. Do you need to flush every time you end a string? I definitely don't have to. Better to just call flush when you need it. ...
Read post

MariaDB C++ Connector Setup for MacOS

For some reason, when I was setting this up, I was having a hard time getting it to work. Save myself the hassle next time by having step by step notes on what I did to get it working. Also has the added benefit of helping someone else if they ever stumble on this. Install MariaDB using brew brew install mariadb This is to get the mariadb C connector which is packaged with the full release/build of mariadb server. After installing it, you don't have to start up the server if you don't need to...
Read post

GTK3, C++, CMake, And CLion

Why? All of the libraries and tools in the title are cross platform. Also wanted to learn GTK3 so I can develop some apps for the Librem 5. Work requires I build software for Windows and Mac, though, so cross platform is a must. Going to outline steps needed to get started with Mac, Linux (Fedora), and Windows. TL;DR Install the gtk libraries for the GTK3 C++ bindings. Mac: brew install gtkmm3 Fedora Linux: sudo dnf install gtkmm30 gtkmm30-devel gtkmm30-doc CLion Cmake (Confirmed to work on ...
Read post

Daily Dose C++: Vector Copy

Note Been keeping busy, missed out on a month of C++ Dosing. NVIDIA GTC a few weeks ago Going through the CPP Con talks Fast.AI video tutorial/book read Learning CMake and GUI Frameworks. (going with GTK) Maybe I should just reduce the scope of the daily dosage. But I digress. Taking a Data structures in C++ class for review/fun. Ran into a problem where we wanted to copy a vector object into a new one. The Dose Iterate and Copy // Lambda to do the copy: auto vectorCopy = [](std::vector...
Read post

Daily Dose C++: Lambdas (Part 2)

Source Back To Basics: Lambda Expressions - Barbara Geller & Ansel Sermersheim - CppCon 2020 Starting from 31:50 C++20 Update Lambda Expression Format: [capture clause] <template parameters> (parameter list) specifier exception attribute -> return type requires {body} specifier keyword: mutable (C++11) constexpr (C++17) Deduced so keyword is optional. Only reason, lambda express NEEDS to be constexpr. Can constexpr be using in a lambda expression? Yes, only if lambda is ...
Read post

Daily C++ Dose: Lambdas (Part 1)

Was reading a blog post about lambdas, and found myself asking what a lambda was really. Then saw there was a great "Back to Basics" presentation on lambdas, so decided to just go through that first. There is a lot to learn about lambdas, so going to break it into multiple posts over multiple days. Source Back To Basics: Lambda Expressions - Barbara Geller & Ansel Sermersheim - CppCon 2020 Up to 31:50 Notes Structure for Lambdas: [](){} [capture](parameters) -> returntype{body} C...
Read post

Daily C++ Dose: Functional Functions

Goal Trying to digest new C++ information everyday (personal goal). These posts aren't meant to rewrite the information read, but just for personal note taking and info digestion. Actually got the idea from the same place I'm reading the new info. Fluent{C++} Source https://www.fluentcpp.com/2016/11/22/make-your-functions-functional/ Notes Try to avoid global variables. They can be accessed anywhere and can break functions. Be expressive with your functions. Define a clear input and outpu...
Read post

Purpose

Just thought I would blog projects I'm working on. Anything really, mostly new things that I'm learning. ...
Read post