What should it say on the label?
[Edit]
Be fairly warned, I could not decide where to put this post; it is a programming question with C++ examples, but the question isn't about the code.
[/Edit]
;_;
So, being that I am a guy who loves the iterator pattern, "commit or rollback", and "ad-hoc" transformations I have a large number of tools designed to decorate iterators to fit my approach to solving problems.
(You can look below for an example.)
The thing is, I have several dozen of these decorations, and for now they have really messy names with lots of near/explicit collisions--like `Iterators::TransformResult', `Iterators::TransformSequence', and `Iterators::TransformSequenceResult'.
The naming isn't as bad for the interface, just various overloads of `Transform' for example, but the template classes to be specialized must exist.
I know this seems like a small thing to many of you, but I've officially reached the point where I can't even keep track of things so anyone else trying to debug code has no chance of following the errors.
Yeah, I could further separate the various flavors into "namespaces" or "tagging", but from an outside perspective `IteratorSomethingNameSpecialty' is not practically different from `Iterator::SomethingNameSpecialty' or `Iterator::Something<NameSpecialty>'.
Help!?
Soma
For example, instead of augmenting the sequence with the "STL":
Code:
/* C++11 */
int main
(
int argc
, char ** argv
)
{
vector<string> sSource(argv + 1, argv + argc);
vector<string> sDestination;
transform(sSource.begin(), sSource.end(), back_inserter(sDestination), [] (const string & f) {return f + '\n';});
copy(sDestination.begin(), sDestination.end(), ostream_iterator<string>(cout, ""));
}
each element within the collection would be augmented:
Code:
int main
(
int argc
, char ** argv
)
{
vector<string> sSource(argv + 1, argv + argc);
auto sDestination = Whatever(sSource, [] (const string & f) {return f + '\n';});
copy(sDestination.begin(), sDestination.end(), ostream_iterator<string>(cout, ""));
}
where the iterator for `sDestination' (whatever type it may be) is doing something like:
Code:
std::string operator * ()
{
return mTransform(mSelf);
}