Results 1 to 3 of 3

Thread: Can QHash::capacity() be smaller than QHash::size()?!?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    28
    Thanked 976 Times in 912 Posts

    Default Re: Can QHash::capacity() be smaller than QHash::size()?!?

    Quote Originally Posted by iw2nhl View Post
    If I understand correctly the documentation, capacity() should give the number of allocated items (which generally is greater than the number of inserted items, for speed reasons).
    In case of QHash the docs say:
    int QHash::capacity () const
    Returns the number of buckets in the QHash's internal hash table.
    Buckets are not items --- they might contain more than one (key, value) pair.

  2. The following user says thank you to jacek for this useful post:

    iw2nhl (24th August 2007)

  3. #2
    Join Date
    Jul 2007
    Posts
    35
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    3
    Thanked 1 Time in 1 Post

    Default Re: Can QHash::capacity() be smaller than QHash::size()?!?

    Quote Originally Posted by jacek View Post
    Buckets are not items --- they might contain more than one (key, value) pair.
    Thank you very much for the explanation!
    Now I'm more secure about my code...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.