c++20

Boost bimap fails to compile with gcc 10, c++20. Looking for temporary fix

跟風遠走 提交于 2021-01-19 05:44:33
问题 With gcc 10.1 and boost 1.73.0, the following code #include <boost/bimap.hpp> int main() { boost::bimap<int, int> lookup; } fails to compile with flags -O2 --std=c++20 , but will succeed with flags -O2 -std=c++17 (verified with compiler explorer). This is possibly related to the following issue: https://github.com/boostorg/bimap/pull/15 (deprecated std::allocator<void> ) Is there some workaround I can use for now to get this code to successfully compile with --std=c++20 ? 回答1: The reason

Variadic CRTP Base Class with Additional Template Parameters

余生长醉 提交于 2021-01-07 02:19:19
问题 I have a trait classes which are about to be used in variadic CRTP to extend the features of SmartPointer class. This question is created as the followup of https://stackoverflow.com/a/65373058/5677080 An example trait class: template<typename DERIVED, typename DELETER> class Owning { public: using deleter_type = DELETER; /* ... */ }; Here comes the implemnetation of my SmartPointer which is being extended by variadic CRTP by those trait classes: template<typename T, template<typename> class

How to use the range version of `transform()` with two ranges?

╄→гoц情女王★ 提交于 2021-01-04 06:05:27
问题 The header <algorithm> contains a version of std::transform() taking a two input sequences, an output sequence, and a binary function as parameters, e.g.: #include <algorithm> #include <iostream> #include <iterator> #include <vector> int main() { std::vector<int> v0{1, 2, 3}; std::vector<int> v1{4, 5, 6}; std::vector<int> result; std::transform(v0.begin(), v0.end(), v1.begin(), std::back_inserter(result), [](auto a, auto b){ return a + b; }); std::copy(result.begin(), result.end(), std:

How to use the range version of `transform()` with two ranges?

假如想象 提交于 2021-01-04 06:01:15
问题 The header <algorithm> contains a version of std::transform() taking a two input sequences, an output sequence, and a binary function as parameters, e.g.: #include <algorithm> #include <iostream> #include <iterator> #include <vector> int main() { std::vector<int> v0{1, 2, 3}; std::vector<int> v1{4, 5, 6}; std::vector<int> result; std::transform(v0.begin(), v0.end(), v1.begin(), std::back_inserter(result), [](auto a, auto b){ return a + b; }); std::copy(result.begin(), result.end(), std:

How to use the range version of `transform()` with two ranges?

送分小仙女□ 提交于 2021-01-04 06:00:51
问题 The header <algorithm> contains a version of std::transform() taking a two input sequences, an output sequence, and a binary function as parameters, e.g.: #include <algorithm> #include <iostream> #include <iterator> #include <vector> int main() { std::vector<int> v0{1, 2, 3}; std::vector<int> v1{4, 5, 6}; std::vector<int> result; std::transform(v0.begin(), v0.end(), v1.begin(), std::back_inserter(result), [](auto a, auto b){ return a + b; }); std::copy(result.begin(), result.end(), std:

How to use the range version of `transform()` with two ranges?

余生长醉 提交于 2021-01-04 06:00:50
问题 The header <algorithm> contains a version of std::transform() taking a two input sequences, an output sequence, and a binary function as parameters, e.g.: #include <algorithm> #include <iostream> #include <iterator> #include <vector> int main() { std::vector<int> v0{1, 2, 3}; std::vector<int> v1{4, 5, 6}; std::vector<int> result; std::transform(v0.begin(), v0.end(), v1.begin(), std::back_inserter(result), [](auto a, auto b){ return a + b; }); std::copy(result.begin(), result.end(), std:

How to use the range version of `transform()` with two ranges?

可紊 提交于 2021-01-04 06:00:01
问题 The header <algorithm> contains a version of std::transform() taking a two input sequences, an output sequence, and a binary function as parameters, e.g.: #include <algorithm> #include <iostream> #include <iterator> #include <vector> int main() { std::vector<int> v0{1, 2, 3}; std::vector<int> v1{4, 5, 6}; std::vector<int> result; std::transform(v0.begin(), v0.end(), v1.begin(), std::back_inserter(result), [](auto a, auto b){ return a + b; }); std::copy(result.begin(), result.end(), std:

Standard way of importing modules

安稳与你 提交于 2021-01-03 03:22:15
问题 I am currently trying to use c++ modules in a code that should compile both on Windows (MSVC) and Linux (Clang and/or GCC). I am currently developping in Visual Studio and used the "Standard Conformance Mode" (/permissive-) to make my code as portable as possible. However the following code: import std.core; int main() { std::cout << "Hello, World! haha" << std::endl; std::vector<int> myVec{4}; std::map<std::string, size_t> myMap; return 0; } Can not compile with the /permissive- flag. I get

Standard way of importing modules

≡放荡痞女 提交于 2021-01-03 03:14:00
问题 I am currently trying to use c++ modules in a code that should compile both on Windows (MSVC) and Linux (Clang and/or GCC). I am currently developping in Visual Studio and used the "Standard Conformance Mode" (/permissive-) to make my code as portable as possible. However the following code: import std.core; int main() { std::cout << "Hello, World! haha" << std::endl; std::vector<int> myVec{4}; std::map<std::string, size_t> myMap; return 0; } Can not compile with the /permissive- flag. I get

Standard way of importing modules

ε祈祈猫儿з 提交于 2021-01-03 03:13:21
问题 I am currently trying to use c++ modules in a code that should compile both on Windows (MSVC) and Linux (Clang and/or GCC). I am currently developping in Visual Studio and used the "Standard Conformance Mode" (/permissive-) to make my code as portable as possible. However the following code: import std.core; int main() { std::cout << "Hello, World! haha" << std::endl; std::vector<int> myVec{4}; std::map<std::string, size_t> myMap; return 0; } Can not compile with the /permissive- flag. I get