Are you over 18 and want to see adult content?
More Annotations
A complete backup of breastcancercentersofamerica.net
Are you over 18 and want to see adult content?
A complete backup of bvlgari-jewelry.us
Are you over 18 and want to see adult content?
A complete backup of thedreamcorps.org
Are you over 18 and want to see adult content?
A complete backup of runninginaskirt.com
Are you over 18 and want to see adult content?
Favourite Annotations
A complete backup of visitfortwayne.com
Are you over 18 and want to see adult content?
A complete backup of valcleytonviana.com.br
Are you over 18 and want to see adult content?
A complete backup of japancandybox.com
Are you over 18 and want to see adult content?
A complete backup of hsbcprivatebank.com
Are you over 18 and want to see adult content?
A complete backup of goodpastureproperties.com
Are you over 18 and want to see adult content?
A complete backup of westinghouselighting.com
Are you over 18 and want to see adult content?
Text
USE STRONGER TYPES!
Simple problems, simple solutions: Use stronger types. The first problem we observed above is that we assigned very general types to variables that had additional semantics. The second was that we used the same general types for variables that have different, incompatible semantics. A std::string is just a bunch of characters, but a namethat
USES OF INHERITANCE
Uses of Inheritance. C++ is a multi-paradigm language, so it is not a purely object oriented language but has other aspects, for example a huge support for generic programming via templates. One of its major strengths is the ability to mix those different aspects. Inheritance is one of the mainly object oriented aspects in C++, and in a purely TRAILING RETURN TYPES EVERYWHERE Trailing return types are an oddity in C++ – we should use them only when necessary.Decide carefully whether to adopt them as a general style, and try to stay consitent. Update: there is a follow-up post to this. Take this post with a grain of salt!LAMBDA OVERDOSE
Lambdas are a nice recent addition to C++. They are cool, they are hip, and they tend to be overused and misused. Since lambda expressions came up in C++11 and got a huge boost in usability in C++14, they have been all the rage. Don’t get me wrong. Lambdas really are useful and cool and everything. But reading blog posts, the CppLang Slack channel and other sources lately has given meMODERN C++ FEATURES
Here we go again with two features that have been added in C++11 that can greatly simplify the code we write. std::begin & Co. std::begin is a free function template that by default does nothing more than calling a begin member function on its argument and returning the result. Its twin is std::end which, as you might have guessed, does the same with an end member function of the argument. SOURCE FILE ORGANIZATION: DIRECTORIES STD::STRING IS NOT A CONTAINER FOR RAW DATA Agreed, std::string is NOT for binary data. However, there is an unfortunate exception, when your C++ binds to another language, like Python. Binders like Swig and Boost and Tornado (sometimes) only recognize a std::string and is thus the only way (at least in Python) to pass binaries to/from C++. WRITE CLEAN AND MAINTAINABLE C++ Colony – A brief history of timing. Matt Bentley February 12, 2021 4. In another guest post, Matt Bentley provides us with new insights into container performance, analyzing the implications on iteration costs of his implementation of the “bucket array” concept. PASSKEY IDIOM: MORE USEFUL EMPTY CLASSES After last week’s post about tag dispatch let’s have a look at another example for useful empty classes: The passkey idiom can help us regain control that we would give up by simply making classes friends.. The problem with friendship. Friendship is the strongest coupling we can express in C++, even stronger than inheritance. THE DARK SIDE OF ERROR LOGGINGUSE STRONGER TYPES!
Simple problems, simple solutions: Use stronger types. The first problem we observed above is that we assigned very general types to variables that had additional semantics. The second was that we used the same general types for variables that have different, incompatible semantics. A std::string is just a bunch of characters, but a namethat
USES OF INHERITANCE
Uses of Inheritance. C++ is a multi-paradigm language, so it is not a purely object oriented language but has other aspects, for example a huge support for generic programming via templates. One of its major strengths is the ability to mix those different aspects. Inheritance is one of the mainly object oriented aspects in C++, and in a purely TRAILING RETURN TYPES EVERYWHERE Trailing return types are an oddity in C++ – we should use them only when necessary.Decide carefully whether to adopt them as a general style, and try to stay consitent. Update: there is a follow-up post to this. Take this post with a grain of salt!LAMBDA OVERDOSE
Lambdas are a nice recent addition to C++. They are cool, they are hip, and they tend to be overused and misused. Since lambda expressions came up in C++11 and got a huge boost in usability in C++14, they have been all the rage. Don’t get me wrong. Lambdas really are useful and cool and everything. But reading blog posts, the CppLang Slack channel and other sources lately has given meMODERN C++ FEATURES
Here we go again with two features that have been added in C++11 that can greatly simplify the code we write. std::begin & Co. std::begin is a free function template that by default does nothing more than calling a begin member function on its argument and returning the result. Its twin is std::end which, as you might have guessed, does the same with an end member function of the argument. SOURCE FILE ORGANIZATION: DIRECTORIES STD::STRING IS NOT A CONTAINER FOR RAW DATA Agreed, std::string is NOT for binary data. However, there is an unfortunate exception, when your C++ binds to another language, like Python. Binders like Swig and Boost and Tornado (sometimes) only recognize a std::string and is thus the only way (at least in Python) to pass binaries to/from C++. OVERLOAD: BUILD A VARIANT VISITOR ON THE FLY Having written about std::variant and std::visit last week, it’s time to string together some modern C++ features to build a naive basic implementation of overload, a proposed C++ feature.. Recap: visitor requirements. As described in the last post, std::visit needs a function object that has overloads that accept all possible variant alternatives. It’s OK if the overloads do not exactly CALLING C CODE FROM C++ WITH 'EXTERN "C"' Now and then we have the need to call functionality that was written in C from our C++ programs. For that, we need to use and understand extern "C".. The probably easiest way to use C functionality in a C++ program is to simply compile the C code as C++ code. MULTIPLE DISPATCH OVER COVARIANT FUNCTIONS A covariant function is a particular kind of function that maps a sum type into the same or another sum type, while at the same time inducing a (one-to-one or many-to-one) map in the individual input and the output alternative types. A covariant function can be seen as the “sum” of many individual functions applying to specific types (an HOW TO PERFORM UNIT TESTING NATIVE C++ CODE IN VISUAL Open a new project in the visual studio panel, and under the C++ tab, choose the test collection. You’ll then be prompted to choose the test type, we’ll go for Native Unit Testing now. Once you, in, you’ll find two source files, go to the unittest1.cpp file. You’llfind a
RETURN EARLY AND CLEARLY There are different guidelines out there about return statements in a function, e.g. return only once at the end of the function or returnearly and often.
SOURCE FILE ORGANIZATION: DIRECTORIES Having test source files in the same directories as the tested source files basically doubles the size of those directories, making them harder to manage. Test directories at each level are also harder to maintain: would a test for src/adir/bdir/x.cpp go below src/adir_test/ or src/adir/bdir_test/ ? Instead, putting that test in test/adir/bdir C++ OBJECT LIFETIMES Their lifetime starts when the liftetime of each subobject has started and – if present – the constructor has completed normally. This can well take some time, so the start of the storage duration, the start of the lifetimes of each subobject and the start of the lifetime of the enclosing object itself can be all different points in time. COMPILER WARNINGS PART 2 1 Tell the compiler which warnings interest you. 1.1 Compiler flags. 1.2 Pragmas. 2 Conclusion. In the last post I wrote about how to change our code to avoid getting compiler warnings. Sometimes that is not a feasible approach and we need to tell your compiler to simplyshut up.
STARTING WITH THE POCO LIBRARIES Almost. There is a little oddity when it comes to Poco. Usually it does not matter much whether you link against the debug or release build of a library. It especially does not matter whether you build a library with the compiler set to C++11 or C++14, given that the ENCAPSULATING APIS IN C++ Encapsulation is the key. The first step to get rid of API dependencies is to encapsulate those API calls in a few dedicated classes. One option is to write wrapper classes and only use the API functions in their implementation. That way you can hide the implementation details, i.e. which API you are calling and how you arecalling it, inside
SIMPLIFY C++!
Colony – A brief history of timing. Matt Bentley February 12, 2021 4. In another guest post, Matt Bentley provides us with new insights into container performance, analyzing the implications on iteration costs of his implementation of the “bucket array” concept. OVERLOAD: BUILD A VARIANT VISITOR ON THE FLY Having written about std::variant and std::visit last week, it’s time to string together some modern C++ features to build a naive basic implementation of overload, a proposed C++ feature.. Recap: visitor requirements. As described in the last post, std::visit needs a function object that has overloads that accept all possible variant alternatives. It’s OK if the overloads do not exactly THE DARK SIDE OF ERROR LOGGING PASSKEY IDIOM: MORE USEFUL EMPTY CLASSES After last week’s post about tag dispatch let’s have a look at another example for useful empty classes: The passkey idiom can help us regain control that we would give up by simply making classes friends.. The problem with friendship. Friendship is the strongest coupling we can express in C++, even stronger than inheritance. CALLING C CODE FROM C++ WITH 'EXTERN "C"' Now and then we have the need to call functionality that was written in C from our C++ programs. For that, we need to use and understand extern "C".. The probably easiest way to use C functionality in a C++ program is to simply compile the C code as C++ code.MODERN C++ FEATURES
Here we go again with two features that have been added in C++11 that can greatly simplify the code we write. std::begin & Co. std::begin is a free function template that by default does nothing more than calling a begin member function on its argument and returning the result. Its twin is std::end which, as you might have guessed, does the same with an end member function of the argument. TRAILING RETURN TYPES EVERYWHERE Trailing return types are an oddity in C++ – we should use them only when necessary.Decide carefully whether to adopt them as a general style, and try to stay consitent. Update: there is a follow-up post to this. Take this post with a grain of salt!LAMBDA OVERDOSE
Lambdas are a nice recent addition to C++. They are cool, they are hip, and they tend to be overused and misused. Since lambda expressions came up in C++11 and got a huge boost in usability in C++14, they have been all the rage. Don’t get me wrong. Lambdas really are useful and cool and everything. But reading blog posts, the CppLang Slack channel and other sources lately has given me COMPILER WARNINGS PART 2 1 Tell the compiler which warnings interest you. 1.1 Compiler flags. 1.2 Pragmas. 2 Conclusion. In the last post I wrote about how to change our code to avoid getting compiler warnings. Sometimes that is not a feasible approach and we need to tell your compiler to simplyshut up.
STD::STRING IS NOT A CONTAINER FOR RAW DATA Agreed, std::string is NOT for binary data. However, there is an unfortunate exception, when your C++ binds to another language, like Python. Binders like Swig and Boost and Tornado (sometimes) only recognize a std::string and is thus the only way (at least in Python) to pass binaries to/from C++. WRITE CLEAN AND MAINTAINABLE C++ Colony – A brief history of timing. Matt Bentley February 12, 2021 4. In another guest post, Matt Bentley provides us with new insights into container performance, analyzing the implications on iteration costs of his implementation of the “bucket array” concept. OVERLOAD: BUILD A VARIANT VISITOR ON THE FLY Having written about std::variant and std::visit last week, it’s time to string together some modern C++ features to build a naive basic implementation of overload, a proposed C++ feature.. Recap: visitor requirements. As described in the last post, std::visit needs a function object that has overloads that accept all possible variant alternatives. It’s OK if the overloads do not exactly PASSKEY IDIOM: MORE USEFUL EMPTY CLASSES After last week’s post about tag dispatch let’s have a look at another example for useful empty classes: The passkey idiom can help us regain control that we would give up by simply making classes friends.. The problem with friendship. Friendship is the strongest coupling we can express in C++, even stronger than inheritance. CALLING C CODE FROM C++ WITH 'EXTERN "C"' Now and then we have the need to call functionality that was written in C from our C++ programs. For that, we need to use and understand extern "C".. The probably easiest way to use C functionality in a C++ program is to simply compile the C code as C++ code. THE DARK SIDE OF ERROR LOGGINGMODERN C++ FEATURES
Here we go again with two features that have been added in C++11 that can greatly simplify the code we write. std::begin & Co. std::begin is a free function template that by default does nothing more than calling a begin member function on its argument and returning the result. Its twin is std::end which, as you might have guessed, does the same with an end member function of the argument. TRAILING RETURN TYPES EVERYWHERE Trailing return types are an oddity in C++ – we should use them only when necessary.Decide carefully whether to adopt them as a general style, and try to stay consitent. Update: there is a follow-up post to this. Take this post with a grain of salt!LAMBDA OVERDOSE
Lambdas are a nice recent addition to C++. They are cool, they are hip, and they tend to be overused and misused. Since lambda expressions came up in C++11 and got a huge boost in usability in C++14, they have been all the rage. Don’t get me wrong. Lambdas really are useful and cool and everything. But reading blog posts, the CppLang Slack channel and other sources lately has given meUSES OF INHERITANCE
Uses of Inheritance. C++ is a multi-paradigm language, so it is not a purely object oriented language but has other aspects, for example a huge support for generic programming via templates. One of its major strengths is the ability to mix those different aspects. Inheritance is one of the mainly object oriented aspects in C++, and in a purely STD::STRING IS NOT A CONTAINER FOR RAW DATA Agreed, std::string is NOT for binary data. However, there is an unfortunate exception, when your C++ binds to another language, like Python. Binders like Swig and Boost and Tornado (sometimes) only recognize a std::string and is thus the only way (at least in Python) to pass binaries to/from C++.USE STRONGER TYPES!
Simple problems, simple solutions: Use stronger types. The first problem we observed above is that we assigned very general types to variables that had additional semantics. The second was that we used the same general types for variables that have different, incompatible semantics. A std::string is just a bunch of characters, but a namethat
TRAILING RETURN TYPES EVERYWHERE Trailing return types are an oddity in C++ – we should use them only when necessary.Decide carefully whether to adopt them as a general style, and try to stay consitent. Update: there is a follow-up post to this. Take this post with a grain of salt! CMAKE PROJECT STRUCTURE 1 Moving the Catch header. 1.1 Add the CMake project structure. 1.2 Using the new CMakeLists.txt. 2 Putting it all together. 3 Conclusion. As promised in the last post about CMake, today we’ll use a proper CMake project structure for our “Hello CMake” project. This postis
RETURN EARLY AND CLEARLY There are different guidelines out there about return statements in a function, e.g. return only once at the end of the function or returnearly and often.
USES OF INHERITANCE
Uses of Inheritance. C++ is a multi-paradigm language, so it is not a purely object oriented language but has other aspects, for example a huge support for generic programming via templates. One of its major strengths is the ability to mix those different aspects. Inheritance is one of the mainly object oriented aspects in C++, and in a purely MORE ABOUT VARIADIC TEMPLATES 2.1 Pack expansion tricks. 2.2 One argument at a time. 3 Nested packs expansion. 4 Fold expressions. 5 Variadic variadic template template parameters. I gave an introduction to variadic templates last week. Today I will talk about some more features that have or will be added in that area in C++11, 14 and 17.MODERN C++ FEATURES
In the last two weeks I have written about the basics of compile time constants and calculation with those constants.This week I conclude this mini series with the keyword `constexpr` added in C++11/14. Limits of C++03 compile time calculationsMODERN C++ FEATURES
The common workaround for this problem has been to provide a make_XXX function that uses function template argument deduction to determine the class template argument types. The above example then could be written as auto myPair = std::make_pair (22, 43.9); However, this requires the use of a function that has a different name, which israther
SOURCE FILE ORGANIZATION: DIRECTORIES Having test source files in the same directories as the tested source files basically doubles the size of those directories, making them harder to manage. Test directories at each level are also harder to maintain: would a test for src/adir/bdir/x.cpp go below src/adir_test/ or src/adir/bdir_test/ ? Instead, putting that test in test/adir/bdir ENCAPSULATING APIS IN C++ Encapsulation is the key. The first step to get rid of API dependencies is to encapsulate those API calls in a few dedicated classes. One option is to write wrapper classes and only use the API functions in their implementation. That way you can hide the implementation details, i.e. which API you are calling and how you arecalling it, inside
Skip to content
WRITE CLEAN AND MAINTAINABLE C++MENU
* Why “simplify C++”?* Contributions!
* About me
* Privacy/Contact
PLF::LIST AND THE DISASSEMBLY OF TIME COMPLEXITY Matt Bentley October 23,2019 8
In his third guest post, Matt Bentley shows us the impact of cache-locality on performance, using plf::list, his implementation of a cache-local linked list as example. MULTIPLE DISPATCH OVER COVARIANT FUNCTIONS Alfredo Correa October10, 2019 0
Today we have another guest post by Alfredo Correa. In his previous article, Functions of variants are covariant, Alfredo described the concept of a covariant function, that is, how a ALGORITHMS AND THE KISS PRINCIPLE Arne Mertz May 29, 2019 4 You’ve probably heard about the rule to prefer standard algorithms over raw for loops. The major reason is that those algorithms say what is happening in the name and encapsulate MACRO EVIL IN C++ CODE Andrey Karpov March 20,2019 6
Today, I am happy to announce a guest post by Andrey Karpov about the evil of macros. Andrey is a Microsoft MVP in the “Developer Technologies” category and one of CPP ON SEA 2019 TRIP REPORT Arne Mertz February 20, 2019 0 From February 3rd through February 6th I have been in Folkestone, UK, to visit the first C++ On Sea conference. REDUCE COMPILATION TIMES WITH EXTERN TEMPLATE Daniele PallastrelliFebruary 12, 2019
3
Today, I have a guest post by Daniele Pallastrelli about extern template for you. Daniele has been programming and designing software for the last 20+ years and he’ s passionateTHE PIMPL IDIOM
Arne Mertz January 15, 2019 9 The pImpl idiom is a useful idiom in C++ to reduce compile-time dependencies. Here is a quick overview of what to keep in mind when we implement and use it. SIMPLE DATA STRUCTURES Arne Mertz December 19, 201810
Keep simple data structures simple! There’s no need for artificial pseudo-encapsulation when all you have is a bunch of data. STD::STRING IS NOT A CONTAINER FOR RAW DATA Arne Mertz November 28, 201811
Sometimes we need unformatted data, simple byte sequences. At first glance, std::string might be a fitting data structure for that, but itis not.
C++ QUIZZES AND TRICK QUESTIONS – DO WE HAVE TO KNOW THE ANSWERS? Arne Mertz November 7, 2018 0 If you follow some C++ social media accounts you will now and then encounter C++ quizzes and trick questions. Do we need to know the answers to be good C++POSTS NAVIGATION
1 2 … 19
Next →
PRIMARY SIDEBAR
Search for:
RECENT POSTS
* plf::list and the Disassembly of Time ComplexityOctober 23, 2019
* Multiple dispatch over covariant functionsOctober 10, 2019
* algorithms and the KISS principleMay
29, 2019
POPULAR POSTS
* C++ Online Compilers * Modern C++ Features - Default Initializers for Member Variables * Modern C++ Features - std::variant and std::visitARCHIVES
Archives Select Month October 2019 (2) May 2019 (1) March 2019 (1) February 2019 (2) January 2019 (1) December 2018 (1) November 2018 (2) October 2018 (1) September 2018 (3) August 2018 (1) July 2018 (3) June 2018 (4) May 2018 (5) April 2018 (5) March 2018 (5) February 2018 (3) January 2018 (4) December 2017 (2) November 2017 (1) October 2017 (1) September 2017 (1) August 2017 (3) July 2017 (3) June 2017 (3) May 2017 (1) April 2017 (2) March 2017 (5) February 2017 (4) January 2017 (4) December 2016 (4) November 2016 (5) October 2016 (4) September 2016 (4) August 2016 (5) July 2016 (4) June 2016 (5) May 2016 (4) April 2016 (4) March 2016 (5) February 2016 (4) January 2016 (4) December 2015 (4) November 2015 (4) October 2015 (4) September 2015 (4) August 2015 (5) July 2015 (4) June 2015 (5) May 2015 (4) April 2015 (4) March 2015 (7) February 2015 (8)January 2015 (9)
CATEGORIES
* C++ (115)
* Modern C++ Features(43)
* Clean Code (65)
* Design Patterns
(11)
* Development (41)
* Tooling (16)
* CMake
(4)
* DSL (4)
* Fix (9)
* General (11)
* Guest Post (15)
* Refactoring (28)
* Refactoring-Session(5)
* Testing (14)
META
* Log in
* Entries RSS
* Comments RSS
* WordPress.org
VISITORS
* 1850236Total visitors: * 1318Visitors today: * 33Visitors currently online:RECENT COMMENTS
* Matthew Bentley on plf::list and the Disassembly of Time Complexity * C++ Visitor Pattern overload – Magazin Online de Imbracaminte, Incaltaminte si Accesoriion
Overload: Build a Variant Visitor on the Fly * Matthew Bentley on plf::list and the Disassembly of Time Complexity * viral on Raw Pointers Are Gonna Stay! * viral on std::string is not a Container for Raw Data * Privacy – Contact – Imprint.
According to data protection laws, I have to inform you that my blog uses cookies. If you stay, I assume that you are happy with it.OKDetails
Copyright © 2024 ArchiveBay.com. All rights reserved. Terms of Use | Privacy Policy | DMCA | 2021 | Feedback | Advertising | RSS 2.0