15,915,509 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Are Riff (Top 36 by date)
Are Riff
19-Feb-16 16:02pm
View
The same thing happen. Just after the hall.erase(itn); and when through the next loop crashes happen with message: Vector iterator is not decrementable.
Did I choose the wrong container?
What should I do if I just want a simple list of name and score sorted as it should in Hall Of Fame (without duplicates). The idea look innocent enough.
Are Riff
19-Feb-16 11:00am
View
thanks, it's simple, back to basic, and working.
Are Riff
17-Feb-16 19:05pm
View
I've removed the reference. I also tried it with const reference.
The error were reported on the .obj files, not on any lines.
But using the g++ it can compile fine. weird.
Are Riff
17-Feb-16 16:26pm
View
I use vs2015
Are Riff
17-Feb-16 16:25pm
View
Nope still doesn't work. Besides double, I tried unsigned long long. Same. Same error. Binary '+=': no operator found which takes a right-hand operandi of type 'const std::chrono::duration<double,std::ratio<1,1>>'(or there is no acceptable conversion)
Are Riff
17-Feb-16 16:21pm
View
Binary '+=': no operator found which takes a right-hand operandi of type 'const std::chrono::duration<double,std::ratio<1,1>>'(or there is no acceptable conversion)
Are Riff
12-Feb-16 7:04am
View
after a good sleep, I kinda got it to work with std::vector <int*> d {&a,&b,&c}
my ultimate purpose is to search from the vector for particular values and id them for further processing later. I might use map instead though. I'm not sure
Are Riff
11-Feb-16 13:04pm
View
sorry, it was something else, it was std::string foo()
Are Riff
9-Feb-16 20:49pm
View
Thanks, I've tried using debugger, but since i'm no expert using debugger, still couldn't explains why that bit of line behave certain way. It might as well I didn't use any :(
Are Riff
9-Feb-16 19:32pm
View
It kinda work but not 100%. Anyway, what just happen? what is this line? never seen one.
Are Riff
9-Feb-16 19:31pm
View
There's not much point to this code except for me understand the related C++ rules. I read few pages of C++ book and try writing some code of my own. The process repeated until I finish the book. Since the book couldn't answer some questions I have, so here I am, asking question, while trying to learn some new points you might kindly points out to me.
I passed playerNum as const ref to show that it won't return any value to it. From what I've read, it just a good practice.
If i'm wrong, tell me I'm wrong.
Are Riff
9-Feb-16 19:14pm
View
Enter name for player1: Enter name for player2:
This is the result in my code. It doesn't give me chance to enter name for player1 but instead just display it and skip it straight to player2.
Are Riff
18-Dec-15 3:30am
View
Thank you :-)
Are Riff
17-Dec-15 21:52pm
View
Able to trim down the 1k lines of code to just 125 retaining the core functions.
http://cpp.sh/7uxk5
Can I get new honest comment?
Please, I'm learning.
Are Riff
17-Dec-15 21:45pm
View
I mean standard C++ containers.
Are Riff
17-Dec-15 16:41pm
View
Nah it's ok. I expected that.
Originally, I did class inheritance from two base classes, but face some linkers error (my bad). So I just put that inheritance idea aside for a while and copy away those classes.
I will review my code and try to shortened it.
Thanks for the honest answer.
sigh.. I still have lots to learn.
Are Riff
17-Dec-15 14:51pm
View
Thanks for your feedback. I really appreciate it.
I should've use deque from the beginning.
I got it to work. The logic also have been fixed.
Take a look.
http://cpp.sh/4pcg
Can you comment a bit on my code. What can I do to improve it?
note: a lot of other code such as the operators are from initial testing when I first created those classes. Is it OK to leave it there?
Are Riff
17-Dec-15 13:57pm
View
Thanks, I'll look it up.
I also think that deque would be better since it is easier to access and pop the first element.
I also removes all the smart pointers and use basic deque because someone commented that STL containers put their elements on the heap anyway.
Are Riff
17-Dec-15 12:55pm
View
I updated the question. Hope it helps.
Are Riff
17-Dec-15 12:51pm
View
The problem didn't occur if I do push_back() within main() itself. It only happen when I move it inside a templated function.
template <typename b="" typename="" a,="">
void battle(vector
&human, vector<b> &zombie){
while (!human.empty() || !zombie.empty()){
human.pop_back();
}
}
I initialize the vector like this:
vector<unique_ptr<warrior>> warriors;
vector<unique_ptr<knight>> knights;
vector<unique_ptr<goblin>> goblins;
vector<unique_ptr<orc>> orcs;
should I not use unique pointer then?
Are Riff
15-Dec-15 13:03pm
View
Are all STL containers dynamically allocated?
Are Riff
15-Dec-15 10:55am
View
Thanks
Are Riff
12-Dec-15 14:22pm
View
Deleted
what?
Are Riff
12-Dec-15 12:54pm
View
Why it works when I write a constructor which didn't take any value?
Warrior(){
_health = 100 * randomize(0.7,0.85);
_attack = 100 * randomize(0.7,0.85);;
}
I will update the question above.
Are Riff
11-Dec-15 14:52pm
View
thanks, I regularly read that website and cplusplus.com
It just sometime (or usually) they explaining something using too much technical words and I ended up needed to reread the same sentence more than twice to really get the meaning :-)
Are Riff
8-Dec-15 6:36am
View
Thanks.
Are Riff
8-Dec-15 6:22am
View
Sorry about that. I posted new question though this time is about prefix increment and postfix increment operator of the same project.
I hope you're kind enough to look through it.
Thanks
Are Riff
8-Dec-15 6:01am
View
Thanks, after fiddling around a bit i got it to work. I forgot add function that return the _armor value.
Warrior::Warrior(const Warrior& v):
Human (v),
_armor {v.getArmor()}
{}
Are Riff
6-Oct-15 1:33am
View
I've updated my question.
Are Riff
6-Oct-15 1:33am
View
I've updated my question. Sorry for wrong choice of word.
Are Riff
8-Sep-15 9:22am
View
I already did ;-)
Are Riff
6-Sep-15 2:53am
View
I agree that C++ is a tool of programming in general.
I also agree that I need to learn few programming language. Before C++, I learned Python for about a month.
The reason why I brought up the question is because I got stuck.
In my case, I stuck understanding the basic of:
1. User define type (class)
2. Function overloading
3. Pointers
Which really slow me down to the point that I stuck. These are very important to allow me to advance a little bit more in learning C++.
Are Riff
6-Sep-15 2:37am
View
I'm pretty competent at computer (Techs articles is all I read everyday), you can name any productivity software, I've used it, Apart from the programming and other coding things .
I taught myself C++ through book and video tutorials.
I use both PC and Mac.
In PC I use Visual Studio 2015, and XCode in Mac.
Programming is the whole different beast though.
I'm still looking for the best way to learn C++ though.
Are Riff
6-Sep-15 2:25am
View
Thanks, I've begun reading a thousand pages book on C++. I guess I've haven't reach the part yet.
Are Riff
5-Sep-15 14:37pm
View
Does 'template' means reading others sample code?
I practice coding using Visual Studio 2015.
What do you mean by managed and unmanaged?
Are Riff
26-Aug-15 5:52am
View
Your condition works.
if ((input_diff > -2.0) & (input_diff < 2.0)) {
cout << "The value between the two is almost equal" << endl;
}
I never thought of that. Clearly I need more practice.
The reason for 0.1 and 2 is I changed it to see whether double is the reason it fail (and forgot to change it back).
I was reading the if statement like this: if input_diff is larger than -2 and smaller than 2, then cout the string (ignore the x=true;, it was from previous experimenting to make it work).
As for the '&', I copied it from another place, it should be a '&&'. But that didn't work too.
Thank You, I learned something here.
Show More