Compilation error on Apple Clang 12.0 due to `std::bind_front` usage in version 3.42
Version 3.42 uses the std::bind_front
function here, which is a C++20 feature. However, Apple Clang 12.0 does not support this function, causing the following compilation error:
/Users/clubie/Documents/Projects/test/ns-3-allinone/ns-3.42/src/core/model/timer-impl.h:155:29: error: no member named 'bind_front' in namespace 'std'
: m_memPtr(std::bind_front(memPtr, objPtr))
~~~~~^
To solve this issue, we can either:
- Replace
std::bind_front
to a lambda expression, or provide our own implementation ofstd::bind_front
, or - Increase the minimum required version of Apple Clang in
CMakeLists.txt
.
Steps to reproduce the issue:
# Prepare Apple Clang 12.0
>>> `which cc` --version
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: arm64-apple-darwin23.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
# Download and build ns-3 v3.42
>>> git clone https://gitlab.com/nsnam/ns-3-allinone.git
>>> cd ns-3-allinone
>>> python ./download.py -n ns-3.42
>>> ./build.py --enable-examples --enable-tests
I'm willing to create a merge request to address this problem if needed.