C:\Users\Matthew\Desktop\study2.cpp In function `const Obj& putOrder(std::vector<Obj, std::allocator<_CharT> >) [with Obj = int]':
44 C:\Users\Matthew\Desktop\study2.cpp instantiated from here
28 C:\Users\Matthew\Desktop\study2.cpp invalid initialization of reference of type 'constint&' from expression of type 'std::vector<int, std::allocator<int> >'
1. , 2. since you dont assign the return value to anything, it should be like this, a void function with a reference input
3. why make it a vector of 1 when it can be a single value!?
4.a,b,c what you did is increment it every time, so after that you would have j+3, when you need just j, and don't get me started on what it would couse in the sorting itself...
So, when you make you code as I improved it, it should wokt, although I haven't realy tested it.
EDIT: I tested it, it works!
Thanks a lot! I know some of the things in my original code were stupid, but I had tried things like Obj temp before and couldn't get it to work, and I was stumped. Your original edited code you posted would not error, but it would not sort either. Is this because the function was defined as const? Thanks again.
Also I can't believe I set it to j++ instead of j+1. Guess I forgot that ++ is the same as j+=1. Wow.