Find a Value in a Container
Parameters

As a starting point, I'd usually advise against passing bools as parameters--especially passing more than one bool to a particular function. I have better ways to spend my time than memorizing the meaning of:

foo(..., false, false, true);


vs.

foo(..., false, true, false);


I suppose I could barely see something like this if you were doing something like passing some bools, and it was putting them together into a bit set, so true, false, true basically just meant 101, but for something like this where each has a unique meaning, it seems unusually difficult to read.

Basic Utility

At least in my opinion, however, that nearly pales compared to the mere fact that I don't see much point in the function existing at all.

People who are accustomed to C++ are generally fairly accustomed to how the standard library works. Most of use would generally rather get an iterator than an index. If we want to search from end to beginning, passing rbegin() and rend() to find makes that intent fairly clear.

For example, if I want to search for the last item, starting 4 from the end, I'd have a much easier time understanding this:

auto p = std::find(foo.rbegin()+4, foo.rend(), value);


...rather than:

int p = Vec_find(foo, foo.size(), value, 4, false, true, true);


or:

int p = Vec_find(foo, foo.size(), value, 4, true, false, true);


[At least as I read things, those are basically the same--either find the last item, or find the first, starting from the end. Oh, and pardon me if I'd passed the wrong thing for the size parameter--I couldn't figure out exactly what it was supposed to do.]

Granted, iterators do tend to lead to fairly verbose code, but in this case, using your code can be even more verbose. I'm pretty sure when ranges become generally available (and sooner, for people who only need to target one compiler, or don't mind using Boost) quite a few people will welcome them with open arms. They can reduce verbosity quite a bit. Given a choice, however, between using this and using the standard library directly, I'd take the standard library without a second thought.