Skip to content

Instantly share code, notes, and snippets.

View jasleon's full-sized avatar

Antonio Sanchez jasleon

View GitHub Profile
@jasleon
jasleon / concatenate_strings_challenge.cpp
Created February 6, 2024 19:15
Variadic Template Exercise
// Challenge: Concatenate Strings
// This coding challenge involves creating a C++ class template called strOps.
// The goal is to concatenate a variable number of strings using variadic
// templates and fold expressions, count the total number of characters in the
// concatenated string, and keep track of the total number of input strings.
// Key Concepts:
// 1. Utilizing variadic templates to accept a variable number of input strings.
// 2. Implementing fold expressions to efficiently concatenate strings.
// 3. Utilizing variadic variable templates to count the total number of input
@jasleon
jasleon / lifetime.cpp
Created January 28, 2024 08:24
C++ Object Lifetime
// https://godbolt.org/z/4xh9KEzx8
#include <iostream>
namespace as {
struct lifetime {
lifetime() { std::cout << "lifetime default constructor\n"; }
lifetime(const lifetime &) { std::cout << "lifetime copy constructor\n"; }
lifetime(lifetime &&) noexcept {
std::cout << "lifetime move constructor\n";
}