Coder Social home page Coder Social logo

cppstories-discussions's People

Contributors

fenbf avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

shepardo

cppstories-discussions's Issues

2021/non-terminal-variadic-args/

Non-Terminal Variadic Parameters and Default Values - C++ Stories

Currently, as of C++20, there’s no support for so called non-terminal variadic arguments. For example, we cannot write:
template <class ...Args> void func(Args&& ...args, int num=42); func(10, 20); // error As you can see, I wanted 10 and 20 to be passed as ...args and 42 as a default value for num.

https://www.cppstories.com/2021/non-terminal-variadic-args/

2021/cpp-arch-book/

Software Architecture with C++, Book Review - C++ Stories

In April, we got a new book - from two Polish authors - Piotr and Adrian - on C++ Software Architecture. This one is fascinating and refreshing. While it won’t teach you all the latest C++ features or low-level tricks in our favorite language, it will move you to a higher level with architecture, building, patterns, design, and development for the cloud.

https://www.cppstories.com/2021/cpp-arch-book/

2021/override-final/

Modern C++: Safety and Expressiveness with override and final - C++ Stories

While C++11 is with us for a decade now, it’s good to go back and recall some of its best features. Today I’d like to consider override and final keywords which add a crucial safety when you build class hierarchies with lots of virtual member functions.
See how to prevent common bugs, and how to leverage tools to make your code safer.

https://www.cppstories.com/2021/override-final/

2019/11/tochars/

How to Convert Numbers into Text with std::to_chars in C++17 - C++ Stories

In this post, I’ll show you how to use the newest, low-level, conversion routines form C++17. With the new functionality, you can quickly transform numbers into text and have super performance compared to previous techniques.
Before C++17 Until C++17, we had several ways of converting numbers into strings:
sprintf / snprintf stringstream to_string itoa and 3rd-party libraries like boost - lexical cast And with C++17 we get another option: std::to_chars (along with the corresponding method from_chars) !

https://www.cppstories.com/2019/11/tochars/

2021/q1-cpp-papers/

Five Awesome C++ Papers for the Q1 2021 and C++23 Status - C++ Stories

Between 2018 and 2020, I released several articles with top 5 proposals just around a new ISO C++ meeting happened. Since March 2020, this pattern broke as the meeting went online. Why not restart the series? :) We can look at the recent papers from a whole Quarter.
Let’s start!

https://www.cppstories.com/2021/q1-cpp-papers/

2019/02/lambdas-story-part1/

Lambdas: From C++11 to C++20, Part 1 - C++ Stories

Lambda expressions are one of the most powerful additions to C++11, and they continue to evolve with each new C++ language standard. In this article, we’ll go through history and see the evolution of this crucial part of modern C++.
The second part is available:
Lambdas: From C++11 to C++20, Part 2

https://www.cppstories.com/2019/02/lambdas-story-part1/

2021/constexpr-new-cpp20/

constexpr Dynamic Memory Allocation, C++20 - C++ Stories

constexpr has become a major feature for compile-time programming in C++. Introduced in a simple form in C++11 evolved into almost another “sub-language”, an alternative to regular template code. In C++20 you can even use std::vector and std::string in constexpr context!
In this article, I’d like to discuss constexpr memory allocations, a building block for std::vector.

https://www.cppstories.com/2021/constexpr-new-cpp20/

2016/05/coding-without-google/

Coding without Google - C++ Stories

Back in 2016, an intriguing article appeared on Reddit: “Do Experienced Programmers Use Google Frequently?”.
The author discussed if expert programmers use google more often than novice coders. He mentioned that using google is a good thing. It helps to find the best solutions, validate ideas, speed the development. Google nowadays seems to be a crucial part of any developer toolbox.

https://www.cppstories.com/2016/05/coding-without-google/

2018/02/static-vars-static-lib/

Static Variables Initialization in a Static Library, Example - C++ Stories

This post is motivated by one important comment from my last article about factories and self-registering types:
(me) So the compiler won’t optimize such variable.
Yet, unfortunately, the linker will happily ignore it if linking from a static library.
So… what’s the problem with the linker?

https://www.cppstories.com/2018/02/static-vars-static-lib/

2021/strong-types-pesel/

Strong Types in C++: A Concrete Example - C++ Stories

When you create a model for your domain, C++ offers you flexibility and increates type-safety with so-called Strong Types. Rather than working with simple built-in types, you can create a set of well-defined classes that better suits your needs. In a new blog post, you can see one concrete example of such a design practice.

https://www.cppstories.com/2021/strong-types-pesel/

2021/security-sins/

C++ Software Security Sins: Basic Issues - C++ Stories

C++ Software Security Sins In the world of software development, we are up against new cybersecurity threats each day, and the risks and consequences of un-secure software are too significant to be unaware of.
Let’s review some common security threats that might lurk in our C/C++ code.
This article is an adapted version of the presentation given by Mary Kelly, supported by Embarcadero.

https://www.cppstories.com/2021/security-sins/

2021/concepts-callables/

Predefined C++20 Concepts: Callables - C++ Stories

Before you start implementing your custom concepts, it’s good to review some goodies in the Standard Library. There’s a high chance that there’s already a predefined concept for you.
Today let’s have a look at concepts related to callable objects.
Where to find them You can find most of the predefined concepts in the header.

https://www.cppstories.com/2021/concepts-callables/

2021/evaluation-order-cpp17/

Stricter Expression Evaluation Order in C++17 - C++ Stories

C++ has many dark corners and many caveats that can cause you to scratch your head in confusion. One of the issues we had until C++17 was the evaluation order of expressions. In this blog post, I’ll show you the new rules that we got in C++17 that made this complicated term much simpler and practical.

https://www.cppstories.com/2021/evaluation-order-cpp17/

2021/filter-cpp-containers/

12 Different Ways to Filter Containers in Modern C++ - C++ Stories

Do you know how many ways we can implement a filter function in C++?
While the problem is relatively easy to understand - take a container, copy elements that match a predicate and the return a new container - it’s good to exercise with the Standard Library and check a few ideas.

https://www.cppstories.com/2021/filter-cpp-containers/

2021/par-devcpp/

Parallel Compilation Experiments in C++Builder and Dev C++ - C++ Stories

Thanks to lots of CPU cores available even in basic computer system we can significantly speed up compilation our projects. In a new article, you can look at techniques and experiments with building things faster in C++ Builder and a well-known free IDE DevC++.
This is an adapted guest post by Eli M and supported by Embarcadero.

https://www.cppstories.com/2021/par-devcpp/

2021/perf-traps/

Top-7 Performance Traps for Every Developer - C++ Stories

According to the recent popular paper “There is plenty of room at the top”1, SW tuning will be one of the key drivers for performance gains in the near future. The growth of a single-threaded performance of modern HW is slowing down, that’s why SW tuning will become more important than it has been for the last 40 years.

https://www.cppstories.com/2021/perf-traps/

2018/11/pstl/

How to Boost Performance with Intel Parallel STL and C++17 Parallel Algorithms - C++ Stories

C++17 brings us parallel algorithms. However, there are not many implementations where you can use the new features. The situation is getting better and better, as we have the MSVC implementation and now Intel’s version will soon be available as the base for libstdc++ for GCC. Since the library is important, I’ve decided to see how to use it and what it offers.

https://www.cppstories.com/2018/11/pstl/

2021/no-unique-address/

Empty Base Class Optimisation, no_unique_address and unique_ptr - C++ Stories

C++20 added a couple of new attributes in the form of [[attrib_name]]. One of them - [[no_unique_address]] - can have surprising effects on the code! In this blog post, you’ll learn how to optimize your classes' layout and make some data members “disappear”. In most cases, it will be just one line of C++20 code.

https://www.cppstories.com/2021/no-unique-address/

2019/07/detect-overload-from-chars/

How To Detect Function Overloads in C++17/20, std::from_chars Example - C++ Stories

The problem: a library function offers several overloads, but depending on the implementation/compiler, some of the overloads are not available. How to check the existence of an overload? And how to provide a safe fallback?
In this article, I’ll show you a background “theory” and one case - std::from_chars that exposes full support for numbers or only integer support (in GCC, Clang).

https://www.cppstories.com/2019/07/detect-overload-from-chars/

2020/04/variant-virtual-polymorphism.html/

Runtime Polymorphism with std::variant and std::visit - C++ Stories

Runtime polymorphism usually connects with v-tables and virtual functions. However, in this blog post, I’ll show you a modern C++ technique that leverages std::variant and std::visit. This C++17 technique might offer not only better performance and value semantics but also interesting design patterns.
Last Update: 2nd Nov 2020 (Passing arguments, Build time benchmark, fixes).

https://www.cppstories.com/2020/04/variant-virtual-polymorphism.html/

2021/stream-logger/

Extensible Stream Logging in Modern C++ - C++ Stories

This blog post will show you how to create a robust and scalable logging library using lots of Modern C++ techniques. The author successfully used this code on Arduino embedded environment and various other production areas.
Let’s dive right in.
Written by Stephen Dolley
Stephen works with C++ commercial and government development teams to upgrade their skills and improve the expressiveness and robustness of their code.

https://www.cppstories.com/2021/stream-logger/

2021/natvis-dbg-tip/

A Debugging Tip: Write Custom Visualizers in Visual Studio - C++ Stories

In Visual Studio, when you work with types from the C++ Standard Library or other common APIs, you might be familiar with a concise view of those objects in debugger. You can hover a mouse over an entity, and then the debugger presents short information about their current state. For example:

http://localhost:1313/2021/natvis-dbg-tip/

2018/05/using-optional/

Using C++17 std::optional - C++ Stories

Let’s take a pair of two types <YourType, bool> - what can you do with such composition?
In this article, I’ll describe std:optional - a new helper type added in C++17. It’s a wrapper for your type and a flag that indicates if the value is initialized or not. Let’s see where it can be useful and how you can use it.

https://www.cppstories.com/2018/05/using-optional/

2021/lambda-story-print/

C++ Lambda Story in Print - C++ Stories

I’m happy to announce the print/paperback version of C++ Lambda Story! After more than a year of updates and smaller changes, the whole project is completed! You can now purchase the book in lots of different formats. See details of this major update and also take part in a giveaway and get the book for free :)

https://www.cppstories.com/2021/lambda-story-print/

2020/08/lambda-capturing.html/

Lambda Week: Capturing Things - C++ Stories

We’re in the second day of the lambda week. Today you’ll learn about the options you have when you want to capture things from the external scope. Local variables, global, static, variadic packs, this pointer… what’s possible and what’s not?
The Series This blog post is a part of the series on lambdas:

https://www.cppstories.com/2020/08/lambda-capturing.html/

2016/12/2016-blog-summary/

2016 Blog Summary - C++ Stories

Another year of blogging! Was it good or bad? What’s the plan now? What were the most popular posts?
First of all, please answer those quick questions: Bartek’s Coding Blog in 2016
The Story Keeping things short I’d like to point out four major things that happened this year:

https://www.cppstories.com/2016/12/2016-blog-summary/

2017/12/why-uniqueptr/

5 ways how unique_ptr enhances resource safety in your code - C++ Stories

Modern C++ stresses the use of RAII objects to manage resources. One of the easiest ways is just to start using unique_ptr across your code.
Let’s see how we can leverage this smart pointer type. I’ve come up with 5 (or more?) reasons where unique_ptr shines.
Intro One of my favourite features of modern C++ is smart pointers.

https://www.cppstories.com/2017/12/why-uniqueptr/

2021/lambda-story-print/

C++ Lambda Story in Print - C++ Stories

I’m happy to announce the print/paperback version of C++ Lambda Story! After more than a year of updates and smaller changes, the whole project is completed! You can now purchase the book in lots of different formats. See details of this major update and also take part in a giveaway and get the book for free :)

https://www.cppstories.com/2021/lambda-story-print/

2018/12/fromchars/

How to Use The Newest C++ String Conversion Routines - std::from_chars - C++ Stories

With C++17 we get another facility to handle the conversion between text and numbers. Why should we care about the new routines? Are they better in any way?
Intro C++, before C++17, offered several options when it comes to string conversion:
sprintf / snprintf sscanf atol strtol strstream stringstream to_string stoi and similar functions And with C++17 you get another option: std::from_chars!

https://www.cppstories.com/2018/12/fromchars/

2018/03/ifconstexpr/

Simplify code with 'if constexpr' in C++17 - C++ Stories

Before C++17 we had a few, quite ugly looking, ways to write static if (if that works at compile time) in C++: you could use tag dispatching or SFINAE (for example via std::enable_if). Fortunately, that’s changed, and we can now take benefit of if constexpr!
Let’s see how we can use it and replace some std::enable_if code.

https://www.cppstories.com/2018/03/ifconstexpr/

2021/q2-cpp-papers/

Five Awesome C++ Papers for the Q2 2021 and C++23 Status - C++ Stories

The work on C++23 continues! Without the face-to-face meetings, the Committee gathers online and discusses proposals and new additions to the language. See my latest report on what changed in C++ in April, May, and June 2021.
Let’s start!
Disclaimer: the view presented here is mine and does not represent the opinion of the ISO C++ Committee.

https://www.cppstories.com/2021/q2-cpp-papers/

2021/05/talk-filter-elements/

How to Filter Elements - the Talk and Optimizations - C++ Stories

Two weeks ago, 20th May, I had a pleasure to talk about filtering elements on our Cracow C++ User Group online meeting.
Here are the slides and additional comments from the presentation.
Finally Restarted After a few months of break, we finally restarted our Cracow’s C++ group!
Thus far we had two presentations in 2021:

https://www.cppstories.com/2021/05/talk-filter-elements/

2019/04/file-pos-log/

Improving Print Logging with Line Pos Info & Modern C++ - C++ Stories

No matter how proficient you are, I think, you might still use one of the primary methods of debugging: trace values using printf, TRACE, outputDebugString, etc… and then scan the output while debugging.
Adding information about the line number and the file where the log message comes from is a very efficient method that might save you a lot of time.

https://www.cppstories.com/2019/04/file-pos-log/

2018/06/variant/

Everything You Need to Know About std::variant from C++17 - C++ Stories

Around the time C++17 was being standardized I saw magical terms like “discriminated union”, “type-safe union” or “sum type” floating around. Later it appeared to mean the same type: “variant”.
Let’s see how this brand new std::variant from C++17 works and where it might be useful.
The Basics In my experience, I haven’t used unions much.

https://www.cppstories.com/2018/06/variant/

2019/03/lambdas-story-part2/

Lambdas: From C++11 to C++20, Part 2 - C++ Stories

In the first part of the series we looked at lambdas from the perspective of C++03, C++11 and C++14. In that article, I described the motivation behind this powerful C++ feature, basic usage, syntax and improvements in each of the language standards. I also mentioned several corner cases.
Now it’s time to move into C++17 and look a bit into the future (very near future!

https://www.cppstories.com/2019/03/lambdas-story-part2/

2021/par-copyif/

Implementing Parallel copy_If in C++ - C++ Stories

In a blog post about a dozen ways to filter elements, I mentioned only serial versions of the code. But how about leveraging concurrency? Maybe we can throw some more threads and async tasks and complete the copy faster?
For example, I have 6 cores on my machine, so it would be nice to see, like 5x speedup over the sequential copy?

https://www.cppstories.com/2021/par-copyif/

2021/06/floating-point-myths/

Three Myths About Floating-Point Numbers - C++ Stories

A single-precision floating-point number is represented by 32 bits and hides various wonderful encoding techniques. However, some of those tricks might cause some imprecise calculations so it’s crucial to know how to work with those numbers.
Let’s have a look at three common misconceptions.
This is a guest post from Adam Sawicki

https://www.cppstories.com/2021/06/floating-point-myths/

2019/07/hasinclude/

Improve Multiplatform Code With __has_include and Feature Test Macros - C++ Stories

Two weeks ago, I showed you a sample that can detect if a function has a given overload. The example revolved around std::from_chars - low-level conversion routine for C++17. In the example, some “heavy” template patterns helped me to write the final code (most notably std::void_t and if constexpr). Maybe there are some other techniques we can use to check if a feature is available or not?

https://www.cppstories.com/2019/07/hasinclude/

pascal software

have an old program i think it written on Turbo Pascal it financial software and request for login password
i need to get this password because the user of this software is left the company long time ago,, anyone can help me
thanks for advance!

2021/q1-cpp-papers/

Five Awesome C++ Papers for the Q1 2021 and C++23 Status - C++ Stories

Between 2018 and 2020, I released several articles with top 5 proposals just around a new ISO C++ meeting happened. Since March 2020, this pattern broke as the meeting went online. Why not restart the series? :) We can look at the recent papers from a whole Quarter.
Let’s start!

https://www.cppstories.com/2021/q1-cpp-papers/

2021/csvreader-cpp17/

How to Parallelise CSV Reader - C++17 in Practice - C++ Stories

At C++Stories (and in my C++17 book) you can find several articles on Parallel Algorithms introduced in C++17. The examples included in those posts were usually relatively straightforward. How about writing something larger?
In this text, you’ll see how to build a tool that works on CSV files, parses lines into sales records and then performs calculations on the data.

https://www.cppstories.com/2021/csvreader-cpp17/

2021/concepts-intro/

C++20 Concepts - a Quick Introduction - C++ Stories

Concepts are a revolutionary approach for writing templates! They allow you to put constraints on template parameters that improve the readability of code, speed up compilation time, and give better error messages.
Read on and learn how to use them in your code!
What is a concept? In short, a concept is a set of constraints on template parameters evaluated at compile time.

https://www.cppstories.com/2021/concepts-intro/

2015/02/non-static-data-members-initialization/

Non Static Data Members Initialization - C++ Stories

With modern C++ and with each revision of the standard we get more comfortable way to initialise fields of a class: both static and non-static: there’s non-static data member initialisation (from C++11) and also inline variables (for static members since C++17).
In this blog post, you’ll learn how to use the syntax and how it changed over the years from C++11, through C++14, C++17 until C++20.

https://www.cppstories.com/2015/02/non-static-data-members-initialization/

2018/02/factory-selfregister/

Factory With Self-Registering Types - C++ Stories

Writing a factory method might be simple:
unique_ptr create(name) { if (name == "Abc") return make_unique(); if (name == "Xyz") return make_unique(); if (...) return ... return nullptr; } Just one switch/if and then after a match you return a proper type.
But what if we don’t know all the types and names upfront?

https://www.cppstories.com/2018/02/factory-selfregister/

2020/12/private-names-trick/

One Trick with Private Names and Function Templates - C++ Stories

Last time in my blog post about How to Share Code with Const and Non-Const Functions in C++ I had a custom type declared and defined in one place (like in a header file). Recently, I tried to separate the declaration from implementation, and I got into a situation where one private function template was left.

https://www.cppstories.com/2020/12/private-names-trick/

2019/04/dir-iterate/

How to Iterate Through Directories in C++ - C++ Stories

How would you implement a function that searches for files with a given extension? For example, finding all text files? or *.cpp files? To code that solution you need a way to iterate through directories. Is that possible in C++ out of the box using the standard library? Let’s see some techniques and new elements that C++17 added.

https://www.cppstories.com/2019/04/dir-iterate/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.