I am trying to wrap a C++ library into a Python module with Boost Python. Everything is OK when I used Python 2.7, but I got segmentation fault when upgraded to 3.6. In my CMakeLists.txt, I wrote find_package(Pythonlibs 3.6 REQUIRED) find_package(Boost COMPONENTS python REQUIRED) message(STATUS ${Boost_INCLUDE_DIR}) message(STATUS ${Boost_LIBRARIES}) message(STATUS ${PYTHON_INCLUDE_DIR}) message(STATUS ${PYTHON_LIBRARIES}) and cmake returned ..

Read more

I am trying to implement a recursive_transform function for Boost.MultiArray. The purpose of this recursive_transform function is to process each element in a input nested iterable data with a given lambda function. The previous version of recursive_transform for some common containers in C++ STL like std::vector and std::array is already achieved as A recursive_transform for ..

Read more

I’m new to C++ languages and I’m writing a data structure which will be used to serialize/deserialize data saved on local machine. The code data structure looks like this: struct DerMeasurementData { float DerAnalogMeasValue = 0.0; int DerStatusMeasValue = 0; int DerMeasQuality = 0; time_t DerReadingTime = 0; time_t DerLastUpdateTime = 0; }; // Ensure ..

Read more

wcout can’t print wstring from wcin in Windows. But in Linux(WSL2 Ubuntu 20.04), it works fine. #include <iostream> #include <fstream> #include <string> #include <locale> using namespace std; int main(int, char**) { locale mylocale(""); locale::global(mylocale); wcout.imbue(mylocale); wcin.imbue(mylocale); wstring name; wcout << L"너의 이름은?"; getline(wcin, name); wcout << name << endl; return 0; } Following is my ..

Read more

For example, the compare of std::less is defined as a template struct template< class T = void > struct less; While std::compare_three_way is defined just as a normal struct, and its operator() is a template function. (code from MSVC) struct compare_three_way { template <class _Ty1, class _Ty2> requires three_way_comparable_with<_Ty1, _Ty2> // TRANSITION, GH-489 constexpr auto ..

Read more