I plan on writing an implementation of std::tuple
. Or to be more exact, I need to write a class which :
- implements a tuple.
- has its own equivalent of
std::get()
(also as a freestanding function). - behaves very much like
std::tuple
in typical use, but - is not necessarily a perfect replacement of
std::tuple
, i.e. it may have behavior differences in corner cases. Specifically, if there the standards committee has had any regrettable choices withstd::tuple
, I don't necessarily want to repeat them. - May depend on a bit of the standard library, but preferably not on any run-time functions. So,
<type_traits>
or<cstdint>
dependencies are fine, some of<utility>
likestd::forward()
, but let's not go crazy. - Should be written in C++11, although C++14 may be relevant if it makes it a whole lot easier/better somehow.
My question has several parts:
- Is it reasonable, given my constraints, to adapt the libstdc++ or libc++ implementation? Perhaps cutting out or replacing some unnecessary/unfortunate parts?
- What significant design decisions will I need to make, when either adapting or writing this anew?
Note: Obviously, this is for an environment where the standard library itself is not available.
Aucun commentaire:
Enregistrer un commentaire