Does Arduino support C++ module import functionality i.e. what would it require to implement something like this in Arduino: import std;
?
1 Answer 1
Modules are a C++20 feature. The configuration files (platform.txt) of the cores provided by Arduino all ask the compiler to use one of the standards gnu++11, gnu++14 or gnu++17. These are C++11, C++14 and C++17 with some GNU extensions.
You will not be able to use C++ modules with standard Arduino cores. You will use the traditional header files instead. Optionally, you may build "Arduino libraries" by following the corresponding specification.
-
@
Edgar Bonet
Understood. Thank you for your comment. AOB: It appears someone gave my question a down vote. Could this have anything to do with my question itself or with the way it was framed? Feedback could help improve my future posts.beebee– beebee10/07/2024 09:38:17Commented Oct 7, 2024 at 9:38 -
BTW, as per libraries, what's your thoughts on using third party vector container libraries? I saw one of such libraries which the author claimed could function like (but slightly different from) native
std::vector<T>
library. However, from your personal experience, could this pose potential drawbacks? Thank you in advance.beebee– beebee10/07/2024 09:51:45Commented Oct 7, 2024 at 9:51 -
@beebee: I have no experience with those. I tend to use statically allocated plain C arrays, in order to avoid memory issues with dynamically-allocated memory.Edgar Bonet– Edgar Bonet10/07/2024 09:59:13Commented Oct 7, 2024 at 9:59
-
Thank you so much. I appreciate your responsebeebee– beebee10/07/2024 11:22:10Commented Oct 7, 2024 at 11:22