Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

324 Neutral

About dalleboy

  • Rank
  1. I concur with Beyond_Repair, for so few elements use a vector and use linear search. If you have a bit more elements you could use a sorted vector and binary search. It will be as fast as map and it will use less memory overhead than map.
  2. Quote:Original post by sheep19 dt here must not be changed, and const reminds me and prevents me from changing it. Not only that, it isn't even used in the function at all... ;)
  3. dalleboy

    CreateThread Question

    You probably don't want to use CreateThread anyway, you would probably want to use beginthread or beginthreadex, if you are to call CRT functions from within the thread.
  4. dalleboy

    ArrayList in C++

    Quote:Original post by SiCrane When you call delete on a managed handle you invoke the destructor for the type, which can be used to free unmanaged resources, though it won't immediately free the memory, which will be garbage collected as normal. I thought that calling `delete` on a managed object, the object was cast to IDisposable, and if that succeeded Dispose was called. I may be wrong though. EDIT: Using .NET Reflector to get IL: C++/CLI: public ref class Foo { public: void Bar() { ArrayList^ readString = gcnew ArrayList(); delete readString; } }; IL: .method public hidebysig instance void Bar() cil managed { .maxstack 1 .locals ( [0] class [mscorlib]System.IDisposable disposable, [1] class [mscorlib]System.Collections.ArrayList readString, [2] int32 num) L_0000: ldnull L_0001: stloc.1 L_0002: newobj instance void [mscorlib]System.Collections.ArrayList::.ctor() L_0007: stloc.1 L_0008: ldloc.1 L_0009: isinst [mscorlib]System.IDisposable L_000e: stloc.0 L_000f: ldloc.0 L_0010: brfalse.s L_001c L_0012: ldloc.0 L_0013: callvirt instance void [mscorlib]System.IDisposable::Dispose() L_0018: ldc.i4.0 L_0019: stloc.2 L_001a: br.s L_001e L_001c: ldc.i4.0 L_001d: stloc.2 L_001e: ret }
  5. Do you have any other watches active in the debugger? Are you watching any property that changes something else?
  6. Quote:Original post by phresnel The allowed stdc++ way is through unions. Except that only one member of a union is active at a time. Usually this isn't a problem as most compilers doesn't care.
  7. The type std::vector<boost::shared_ptr<const Item> > is not related to std::vector<boost::shared_ptr<Item> >. Quote:Is there a way to return the vector but not allow the caller to modify it? 1. You could return a std::vector<boost::shared_ptr<const Item> > by value. std::vector<boost::shared_ptr<const Item> > getItems()const {return std::vector<boost::shared_ptr<const Item> >(m_Inventory.begin(), m_Inventory.end());} 2. You could return an iterator/iterator-range: MyConstIteratorRange getItems()const {return MyConstIteratorRange(m_Inventory.begin(), m_Inventory.end());} I leave the implementation of MyConstIteratorRange to you... :) 3. You could return one element at a time, as your example: boost::shared_ptr<const Item> getItem(unsigned int index)const {return m_Inventory[index];}
  8. dalleboy

    Shortcut thrown into Startup folder.

    SHGetSpecialFolderPath(NULL, szBuffer, CSIDL_STARTUP, TRUE);
  9. dalleboy

    C++/STL - Slow? SOLVED

    Use a profiler on a release build to find the culprit.
  10. Could you post some code, or could you condense the problem to a few lines?
  11. Wasn't there a bug in the Visual Studio 2005 pre SP1 version of std::basic_stringstream? Are you using VS2005? Have you installed SP1?
  12. Hmm, I dunno. But perhaps the numpunct class in <locale> could be of interest. That's the way to control the digit grouping in C++ streams. [Edited by - dalleboy on October 9, 2008 2:01:08 PM]
  13. Why not the other way around? class Base { }; class Derived : public Base { }; int main(int argc, char* argv[]) { boost::shared_ptr<Derived> d(new Derived); boost::shared_ptr<Base> b(d); } Works like a charm...
  14. Shouldn't you pass a texture id returned from glGenTextures?
  15. Quote:Original post by Evil SteveWhat do you suggest they do? Provide everyone with irrelevant files via Windows Update that may never be used? It's the application installers job to correctly install any dependant files. If you don't do that, it's your own lookout, not Microsoft or anyone elses. The problem is that CRT for VS2005-SP1 isn't compatible with CRT for VS2005-RTM, and that you cannot have CRT for VS2005-SP1 and CRT for VS2005-RTM installed at the same time.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!