One thing that's becoming quite annoying in Obj-C++ is how selectors and templates don't play nicely together. I'd like to know how to get around the following situations:
1. (Fairly trivial if somewhat frustrating) Suppose I have this:
std::array<id, 3> threeIDs = {@"foo", @"bar", @"baz"};
Is there a way to create an NSArray containing these three ids without passing in the size of the array separately? Something like this pseudocode:
template<size_t N>
+ arrayWithStdArray:(std::array<id, N>) array;
2. (Same thing but more frustrating) Suppose instead of this I have iterators to an STL container of ids. Is there a way to create an NSArray containing these ids without having to state what container they are? Something like this:
template<class InputIterator>
+ arrayWithSTLIteratorsBegin:(InputIterator) begin andEnd:(InputIterator) end;
As an aside (so as to not divert this into a "this is a cocoa-dev question" debate), would an actual implementation of export in C++ have made the "templated selector" possible in Objective-C++?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden