Jump to content

Roland

Developers
  • Posts

    2,953
  • Joined

  • Last visited

Everything posted by Roland

  1. Roland

    Forum Update

    Looks great and finally a descent code presentation
  2. Lucky you to see such a beautiful face now and then ?. Anyway I hope this finally means that our code indentions will be treated with respect and dignity
  3. TAB seems to be 8, think 4 would be better
  4. The reason why remove is slow is that all non-removed item are shifted towards the front of the list while the container keeps it's size. After the operation remove returns an iterator past the last non removed item. Removed items are actually not removed​ but just marked as removed. The idea is to bring down the amount of memory allocations and get a continuous vector. You can also use remove to remove all items of a certain value from the vector Here's some notes on iteration on a vector http://fastcpp.blogspot.se/2011/03/fast-iteration-over-stl-vector-elements.html?m=1 There are quite a few types of containers, each one suited for different situations and with their drawbacks in other situations. There is no "the fastest" I'm afraid.
  5. Hard to say without seeing how Link, LinkedList and LinkNode looks like.
  6. Error in C++ - ElseIf int n = 2; if (n == 1) { Print("n equals 1"); } elseif(n == 2) { Print("n equals 2"); } elseif(n == 3) { Print("n equals 3"); } should be int n = 2; if (n == 1) { Print("n equals 1"); } else if(n == 2) { Print("n equals 2"); } else if(n == 3) { Print("n equals 3"); }
  7. Yes using a reference is of course more efficient
  8. Unfortunately I think it's a Microsoft thing, maybe some Linux user can correct me if I'm wrong on that one.
  9. template <typename T> class Link { public: Link(); ~Link(); Link* next; Link* prev; Link* list; T value; }; int main() { Link<int> link1; link1.value = 10; Link<std::string> link2; link2.value = "Hello World"; return 0; }
  10. Well great then If it works it does. So problem solved
  11. Just some free thoughts on this If you are after most efficiency use either std::vector or simple arrays. Using std::list or std::map is not at all suited for games as iterating over them is quite slow compared to vector If possible store the objects and not pointers to them in your array in order to get contiguous memory. Iterating over any data in non-contiguous memory imposes a lot of cache misses in general and removes the ability for the compiler and CPU to do effective cache prefetching. This alone can kill performance When removing from your vector use the 'swap/pop' method. This way you keep your array contiguous std::swap(entitys[index], entitys()); entitys.pop_back(); This of course assumes you know the index of your object. This can be known this way myArray.push_back(object); object.index = myArray.size()-1 then you removes it with std::swap(myArray[object.index],myArray.back()); myArray.pop_back();
  12. Unfortunately I have no idea how the remove work behind the scene.
  13. Node need to have iterators dangling around world->entities.push_front(this); // or world->entities.push_back(this); //... //.. std::remove(world->entities.begin(), world->entities.end(), this);
  14. Hi there Josh. First of all the interator sample has an error std::vector myvector = {"Bob", "Jane", "Fred"}; for (auto it = myvector.begin(); it != myvector.end(); it++) { std::string element = (*it); Print(element); } should be std::vector<std::string> myvector = {"Bob", "Jane", "Fred"}; for (auto it = myvector.begin(); it != myvector.end(); it++) { std::string element = (*it); Print(element); } secondly you can create the vector and iterate in a less mysterious way if you don't care what myvector actually is. auto myvector = { "Bob", "Jane", "Fred" }; for each( auto element in myvector ) { Print(element); } if you do care its std::vector<std::string> myvector = { "Bob", "Jane", "Fred" }; for each( auto element in myvector ) { Print(element); }
  15. Yep. Started with "No knowledge of C++" then covered most things. Classes, Inheritance, Polymorfism, Standard Templates and so on ending up in some Leadwerks scene samples. To bad they are lost and I have no own backup either as I bough a new pc since then and AGAIN!!! was to lazy to make a DVD backup as I had it on YouTube...
  16. Yes I did. But then I switch to a new account, deleted the old one. Of course I forgot to backup them. Yes! Totally idiotic but that's what happened. About 20 videos about C++ lost Sorry about that
  17. aiaf, on 17 May 2017 - 08:35 PM, said: Im interested to do this. Was interested but I guess there will be the same problem for me
  18. I keep on getting the error "Asset map value is different" in the Errors tab, although everything seems to work. A bit irritating as that removes focus from the Output tab when running. No errors on the Output tab when loading. Okay then I though. Lets delete the map and make a new one. Same result and its really not a complicated map. A Terrain and some boxes and spheres. I have the latest Beta. Any idea on how to get rid of this annoying thing?
  19. Right down at the right bottom you have 'Who's Online' which is a chat tool
  20. Lerp is a linear interpolation. Maybe that would work better?
  21. Title says it all If answer is YES I'm disappointed as it shouldn't in my humble opinion
  22. As long as the current "have it all" version is available
  23. Will be there if I manage to figure out what time that is in northern Sweden
  24. https://github.com/alrusdi/leadwerks-blender-exporter
×
×
  • Create New...