If what you really want to do is generating the vector of all possibles solutions and then test them, you will have to use the preprocessor to generate them all for you.
However, another solution would consist into using a generator: a wrapper class which will instantiate all your solutions and test them. You might want to consult the Hierarchy Generators of Loki (detailed in the book).
// never remember where they put boost::same_type :x
#include <boost/mpl/if.hpp>
#include <boost/mpl/deref.hpp>
#include <boost/mpl/begin.hpp>
#include <boost/mpl/end.hpp>
#include <boost/mpl/next.hpp>
using namespace boost::mpl;
struct None
{
static void test() {}
};
template <class UIterator, class UTypes,
class VIterator, class VTypes,
class WIterator, class WTypes>
class Generator;
template <class UIterator, class UTypes,
class VIterator, class VTypes,
class WIterator, class WTypes>
struct Next
{
// u_begin is not necessary ;)
// it would be cheaper not to pre-declare all of them since we force evaluation
// however this dramatically increase the readability
typedef typename begin<VIterator>::type v_begin;
typedef typename begin<WIterator>::type w_begin;
typedef typename next<UIterator>::type u_next;
typedef typename next<VIterator>::type v_next;
typedef typename next<WIterator>::type w_next;
typedef typename end<UIterator>::type u_end;
typedef typename end<VIterator>::type v_end;
typedef typename end<WIterator>::type w_end;
typedef if_< boost::same_type<w_next, w_end>,
if_< boost::same_type<v_next, v_end>,
if_< boost::same_type<u_next, u_end>,
None,
Generator< u_next, UTypes,
v_begin, VTypes,
w_begin, WTypes >
>,
Generator< UIterator, UTypes,
v_next, VTypes,
w_begin, WTypes >
>,
Generator< UIterator, UTypes,
VIterator, VTypes,
w_next, WTypes>
>::type type;
};
template <class UIterator, class UTypes,
class VIterator, class VTypes,
class WIterator, class WTypes>
struct Generator
{
typedef S< deref<UIterator>::type,
deref<VIterator>::type,
deref<WIterator>::type > S_type;
typedef Next<UIterator, UTypes,
VIterator, VTypes,
WIterator, WTypes>::type next_type;
static void test()
{
// test my variation of S
S_Type my_S;
test_func(my_S);
// test the variations of my next and its next and... you get the idea :)
next_type::test();
}
};
// And finally
int main(int argc, char* argv[])
{
typedef Generator< begin<u_types>::type, u_types,
begin<v_types>::type, v_types,
begin<w_types>::type, w_types > base_generator_type;
base_generator_type::test();
}
Disclaimer: this code has not been compiled and may lack some include / typename / use directives... nevertheless I hope you get my point.
If you have any idea of what the Design Patterns are, it is highly similar to a 'decorator' or a 'composite' design in its way of adding another round of tests at each step layer.
I would also like to note that this takes more that 50 lines of code... but at least it will grow nicely with the vectors :)
Best Answer
I achieved what I wanted by clicking on a ui element (button, image, text, etc) and going to the Layout menu (at the top of screen) and then I used "bring to front", "send to back", etc.
In Xcode 4.2 you'll find the options in menu up top: Editor->Arrange