Advanced C++ CookBook, published by Packt
If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.
Advanced C++ Programming CookBook, published by Packt
License: MIT License
Advanced C++ CookBook, published by Packt
If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.
Simply click on the link to claim your free PDF.
In main function, the "s.push(4)..." would make more sense if it is replaced by "std::thread t1( [&]{ s.push(4) };); t1.join()", all the way to "std::thread t6( [&]{ s.push(42) };); t6.join()", since we might use multi-threaded execution to test if a class is thread-safe.
Hello, so I follow the instructions on the book, p.182 but it turns out, on my machine running ubuntu 20.04 at least, that make cannot create the executable for recipe01_example01:
/home/.../Chapter06/recipe01.cpp:27:10: fatal error: hayai.hpp: No such file or directory 27
| #include <hayai.hpp>
| ^~~~~~~~~~~
compilation terminated.
Seen that, I tried to download hayai from the author's repository, but with no success as the ppa itself is outdated:
404 Not Found [IP: 185.125.190.52 80]
...
Reading package lists... Done`
E: The repository 'http://ppa.launchpad.net/bruun/hayai/ubuntu focal Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
As last resort, I then tried to copy the hayai.hpp file and its other header dependencies from the github repo directly into my chapter06 folder...to no avail, as compilation yields many errors, probably due to the fact that the .hpp files on github are tailored on a token example.
I tried to build examples as per instruction:
> mkdir build && cd build
> cmake ..
> make recipe01_examples
But got above errors.
In the repository the directories starts with capital letter: Chapter01, ... while in CMakeLists.txt it was used with small letter:
add_chapter(chapter01)
...
Then I tried to change all entries in CMakeLists.txt:
add_chapter(Chapter01)
...
then command
cmake ..
works ok, but make is not working:
make recipe01_examples
As things stand right now cloning Catch2 git repo fails.
Version 3 of Catch2 can be downloaded by modifying the CMakeLists.txt
of Chapter07 at lines 46-61 as follows:
add_custom_target(recipe01_examples)
list(APPEND CATCH_CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/external/
)
ExternalProject_Add(
catch
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG origin/devel
GIT_SHALLOW 1
CMAKE_ARGS ${CATCH_CMAKE_ARGS}
UPDATE_COMMAND cmake -E echo "-- Skipping update"
)
include_directories(${CMAKE_BINARY_DIR}/external/include)
recipe01.cpp
has then to be modified so to accommodate the new multi-header approach of Catch2 v3, with its multiple updates of function names and namespaces.
A far better approach to solve this would consist in downloading Catch2 v2 from here, to place it in the ./Chapter07/build folder, and to modify #include <catch.hpp>
to #include "catch.hpp"
everywhere inside recipe01.cpp
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.