AMA with Inbal Levi - Meeting C++ 2022
Hot off the video press:
October 25, Pavia, Italy
November 6-8, Berlin, Germany
November 3-8, Kona, HI, USA
By Blog Staff | Dec 19, 2022 02:10 PM | Tags: None
Hot off the video press:
By Blog Staff | Dec 19, 2022 01:53 PM | Tags: None
With or without actual templates:
by Rainer Grimm
From the article:
The key idea of the Template Method is easy to get. You define the skeleton of an algorithm that consists of a few typical steps. Implementation classes can only override the steps but cannot change the skeleton. The steps are often called hook methods...
By Blog Staff | Dec 17, 2022 03:05 PM | Tags: None
ABSA == Ask Bjarne Stroustrup Anything:
By Blog Staff | Dec 17, 2022 03:00 PM | Tags: None
More safety please:
by Gabor Horvath
From the article:
The C++ Core Guidelines’ Lifetime Profile, aims to detect lifetime problems, like dangling pointers and references, in C++ code. ... Lately, there has been an increased push in the C++ community to introduce lifetime-related safety features, which has led us to revisit the lifetime analysis in MSVC.
We spent the last couple of months looking into the results of using the lifetime analysis on real world code. This blog post summarizes our experience and the improvements we made along the way. The biggest change is the introduction of a new set of warnings. These warnings are the high-confidence versions of the existing warnings. Users who want less noise can enable only the high-confidence warnings, while users who want more rigorous checks at the cost of noise can enable both the old and the new warnings. As of 17.5, the high-confidence warnings are still experimental, but depending on the feedback we might include them in some of the recommended profiles in future versions...
By Blog Staff | Dec 17, 2022 02:59 PM | Tags: None
When profiling is a good thing:
C/C++ Profiling Tools
by David Faure
From the article:
This blog will give you a brief overview of profiling C and C++ applications. Additionally, it will lay before you all of the tools available, with the purpose of aiding you in choosing the right tools at the right times...
By Blog Staff | Dec 17, 2022 02:45 PM | Tags: None
Const... times four:
by Bartlomiej Filipek
From the article:
As of C++20, we have four keywords beginning with const. What do they all mean? Are they mostly the same? Let’s compare them in this article...
By Blog Staff | Dec 16, 2022 01:29 PM | Tags: None
Just in time for the holidays, a major new Taylor Swift album Boost library release just dropped:
Boost verison 1.81.0 released
Release managers: Marshall Clow and Glen Fernandes
From the announcement:
New Libraries
URL:A library for parsing, modifying, and printing URLs using only C++11, from Vinnie Falco and Alan de Freitas. Features include fast compilation, strong invariants, and strict compliance using a memory-friendly approach.Updated Libraries
Asio:
Added theconsigncompletion token adapter, which can be used to attach additional values to a completion handler. Addedany_completion_handler<>, which can be used to type-erase completion handlers. Addedexperimental::co_composedto enable lightweight implementations of user-defined asynchronous operations using C++20 coroutines. Add range-basedexperimental::make_parallel_group()overloads. Addedany_completion_executor, a type-erased wrapper for executors that are associated with completion handlers. Added missingcontextquery to use_future's executor. Added nothrow constructor overloads toexecution::any_executor<>andany_io_executor. Optimised representation of emptyexecution::any_executorobjects to improve the performance of copy and move operations. Added anassociated_cancellation_slotspecialisation forstd::reference_wrapper. Changed I/O objects to return their executors by const reference. Changed associated to use deduced return types for all two-argumentgetfunctions. Fixedspawnimplementation to catch unhandled exceptions and rethrow them outside of the spawned "thread". Fixedspawnto ensure the completion handler is dispatched through the correct executor. Fixed cleanup of of terminal-statespawn"thread" objects. Fixedspawnandco_spawnimplementations to dispatch cancellation handlers on the correct executor. Changed semantics of 'dispatch' to mean the executor is used as-is. Deprecated theexecution::executecustomisation point and sender/receiver facilities. Added a C++11parallel_groupexample. Fixed example code to not use the deprecatedresolveconversions. Fixed an ambiguity inexperimental::channel_traitsspecialisations. Added a specialised channel implementation for the forR(error_code)signature. Madecancelled()public on theasync_compose'self' object. Added io_executor_type and get_io_executor to theasync_compose'self' object. Fixed implementation ofrelease()for Windows overlapped handles. Enabled deferred awaiting forexperimental::coro, regularisedexperimental::use_coro, and fixed allocator handling. Cleaned upexperimental::promiseand made it an asynchronous operation object. Constrainedpost/deferoverloads on ability to requireblocking.never. Changed descriptor implementation to fall back tofcntlifioctlfails withENOTTYwhen setting non-blocking mode. Fixed Xcode deprecation warnings related to use ofsprintf. Fixed the arguments passed toselect_reactor::runwhen it is run on an internal thread. Fixed compilation errors whenBOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLINGis defined. Updated detection of C++20 coroutine support on clang 14 and later. Changed standard library feature detection to always enablestd::invoke_resultwhen targeting C++17 or later. Fixed detection of return type deduction with MSVC. Updated the asynchronous operation requirements to relax the requirements on the associated executor. Added io_uring to the implementation notes. Consult the Revision History for further details. Beast:
Addbuffers_generator Addbeast::http::message_generator Addedbuffer_ref, so beast buffers can be used with asio. Support for per-operation cancellation C++20 awaitable examples. websocket per-message compression options websocket timeout option api multiple content length error Support for default-completion and rebind Container Hash:
Major update. The specializations ofboost::hashhave been removed; it now always callshash_value. Support forBOOST_HASH_NO_EXTENSIONShas been removed. The extensions are always enabled. All standard containers are now supported. This includesstd::forward_listand the unordered associative containers. User-defined containers (types that havebegin()andend()member functions that return iterators) are now supported out of the box. Described structs and classes (those annotated withBOOST_DESCRIBE_STRUCTorBOOST_DESCRIBE_CLASS) are now supported out of the box.hash_combinehas been improved. The performance (and quality, as a result of the above change) of string hashing has been improved.boost::hashfor strings now passes SMHasher in 64 bit mode. The documentation has been substantially revised to reflect the changes. Core:
empty_valuemembers are now marked asconstexpr. Addedfclose_deleter, a deleter that callsstd::fcloseon a pointer tostd::FILE. Bit manipulation utilities inboost/core/bit.hppnow explicitly require unsigned integers on input. (#129)bit_widthnow returnsintinstead of a value of the input argument type. This follows resolution of LWG3656. Describe:
To allow the inclusion ofenumerators.hpp,bases.hpp, andmembers.hppwhen the option-pedanticis used, the invocation ofBOOST_DESCRIBE_ENUMhas been moved frommodifiers.hppinto a separate header,modifier_description.hpp. As a consequence,modifiers.hppno longer includesenum.hpp. Code that has been relying on this implicit inclusion may fail, and will need to be fixed to includeenum.hpp. Filesystem:
Deprecated:pathconstruction, assignment and appending from containers of characters, such asstd::vector<char>orstd::list<wchar_t>, is deprecated in v3 and removed in v4. Please use string types or iterators instead. Deprecated:boost/filesystem/path_traits.hppheader is deprecated and will be removed in a future release. The header contained implementation details ofpathand should not be used in user's code. Previously deprecated APIs will now generate compilation warnings on use. To suppress these warnings,BOOST_FILESYSTEM_ALLOW_DEPRECATEDmacro can be defined when compiling user's code. Fixed compilation due to a missing include on POSIX systems that do not support*atAPIs. (#250) On Windows, fixedweakly_canonicalfailing with anERROR_INVALID_FUNCTIONerror code if the path started with the "\\?\" prefix. (#247) Added support forstd::string_view,boost::string_viewandboost::container::string(as well as respectivewchar_tcounterparts) inpathconstructors, assignment and appending operations. (#208)pathconstructors, assignment and appending operations taking a pair of iterators will no longer accept iterators with value types that are not one of the supported path character types. On Windows, deduplicated files are now reported as regular files rather than reparse files. (#262) Fusion:
Addedfusion::identity_view(PR#240) Added support for associative sequences onfusion::transform_view(PR#239) Fixed compilation for the case whenfusion::reverse_viewused with an associative sequence (PR#237) Fixed Clang 13 -Wdeprecated-copy warnings (PR#261) A small dependency reorganization. Nowboost::refandboost::noncopyableare used from Boost.Core (PR#249) Histogram:
Major update. Added newaccumulators::fractionto compute fractions, their variance, and confidence intervals Added interval computers for fractions:utility::clopper_pearson,utility::wilson_interval,utility::jeffreys_interval,utility::wald_intervalwhich can compute intervals with arbitrary confidence level Addedutility::confidence_levelandutility::deviationtypes to pass confidence levels as probabilities or in multiples of standard deviation for all interval computers, respectively Fixed internalsub_arrayandspanin C++20 Iterator:
function_output_iteratornow supports perfect forwarding of the assigned values to the wrapped function object. (PR#73) Fixed compilation of constructing afunction_input_iteratorfrom result of post-incrementing anotherfunction_input_iterator. (#75) The result of post-incrementing an iterator based oniterator_facadenow supportsoperator->.(it++)->foois equivalent to(*it++).foo, which was supported before. JSON:
Addedobject::stable_erase. Addedparseoverload forstd::istreamandoperator>>forvalue. Added rvalue ref-qualified accessors forvalue. Conversion traits were redesigned. Added conversion support for described classes and enums,std::optional,std::variant, and null-like types (includingstd::nullptr_t,std::nullopt_t, andstd::monotype). Added non-throwing conversion fromvalueto user types. Locale:
Major update with some breaking changes. C++11 support is now required, support for C++03 and earlier is dropped Some enums have been converted to enum classes - Avoids name clashes Replace-sICU_LINK_LOCALE&-sICU_LINKby fine-grained configuration options as done in Boost.RegEx Fix detection of libiconv allowing Boost.Locale to be build (again) on some platforms Remove use of and support forstd::auto_ptr Make thecodecvtusingwchar_ton Windows assume/use UTF-16 enconding Performance improvements: Makebasic_format,date_time&hold_ptrmovable, Fix use of format cache Make Boost.Locale compatible with more ICU versions (especially the tests) Fix RTTI definitions for some classes (visibility issues) Fix compatibility of the ICU backend with some libc++ versions Fix return value of some operators to correctly return non-const*this Fix int-overflow on negative roll of years indate_time Handle or suppress many warnings which makes the build log cleaner Add support for more Windows codepages Fix support for Windows codepages like ISO-2022-JP Nowide:
Fix build failure of tests on MSVC Stacktrace:
The library does not use COM initialization any more. Thanks to Alex Guteniev for the bug report, clarifications and PR PR#123! The library now may useBOOST_STACKTRACE_BACKTRACE_INCLUDE_FILEmacro value while detecting the libbacktrace availability in b2, thanks to Ben Gemmill for the bug report #115. AddedBOOST_STACKTRACE_BACKTRACE_FORCE_STATICmacro to force a single backtrace_state static instance while using the libbacktrace. Thanks to the Rasmus Thomsen for the bug report #118! Avoid unresolved references when including only theboost/stacktrace/stacktrace.hppheader. Thanks to the Long Deng for the bug report #116. Optimized stacktrace printing by not callingstrlenon Windows platforms. Thanks to Alex Guteniev for the bug report #122 PFR: STLInterfaces:
Fix two ill-formediterator_interfaceoperators in pre-C++20 iterators with aconstvalue_type. System:
The macroBOOST_SYSTEM_DISABLE_THREADScan now be defined to disable the use of<mutex>(e.g. on single-threaded libstdc++). Addedvalue_type,error_type,in_place_value,in_place_errortoresult<>. Addedemplacetoresult<>. Unordered:
Major update. Added fast containersboost::unordered_flat_mapandboost::unordered_flat_setbased on open addressing. Added CTAD deduction guides for all containers. Added missing constructors as specified in LWG issue 2713. Variant2:
Added support forboost::json::value_fromandboost::json::value_to.
By Andrey Karpov | Dec 16, 2022 01:00 AM | Tags: visual studio code qt creator pvs-studio
PVS-Studio 7.22 has been released. It includes plugins for Visual Studio Code and Qt Creator, support of .NET 7 projects analysis, enhanced Best Warnings filter and new diagnostic rules.
PVS-Studio 7.22: Visual Studio Code, Qt Creator, .NET 7
by Sergey Vasiliev
From the article:
New plugins provide even more options for cross-platform work. Now you can use them to work with logs: view warnings, filter them, sort them in a grid, etc. You can't run the analysis yet — we plan to add this feature in future releases.
By Andrey Karpov | Dec 12, 2022 07:01 AM | Tags: static analyzer pvs-studio
Best Warnings — the analyzer's mode that displays 10 most interesting warnings in the output window. We invite you to take a look at the updated Best Warnings mode on the example of the RPCS3 project check.
PVS-Studio and RPCS3: the best warnings in one click
by Alexander Kurenev
From the article:
Best Warnings is a special mechanism for the first acquaintance with the PVS-Studio static analyzer. The full analyzer's log can contain thousands of warnings. Therefore, if you want to evaluate the work of the analyzer and not waste time and effort on viewing a large report that was issued by a not yet configured analyzer, use the Best Warnings mechanism. Open the analyzer's log in the PVS-Studio plugin for Visual Studio and enable Best Warnings.
By Meeting C++ | Dec 10, 2022 11:38 AM | Tags: meetingcpp intermediate community c++20 basics advanced
The opening keynote of Meeting C++ 2022 is now online!
Belle Views on C++ Ranges, their Details and the Devil - Nico Josuttis - Keynote Meeting C++ 2022
by Nicolai Josuttis
Watch it now