Note that there are some explanatory texts on larger screens.

plurals
  1. USteambob
    primarykey
    data
    text
    plurals
    1. This table or related slice is empty.
    1. COThanks for posting your code. I can immediately see a few problems. self.dev is not used. You probably want to use self.dev in a WHERE clause for the SQL query. It would be much faster not to reopen the database each time (self.db_source?) and not reopen the XML file each time. Also opening the same file in 'w' mode will erase its contents each time.
      singulars
    2. CO@janm: Although if you don't know the approximate final size of the data set (so you can use std::vector::reserve() ) the potential need to copy during reallocation of the vector may offset the caching advantages. All I did was to provide an *alternative* solution to the problem that no-one else mentioned. It is extremely important to know your tools - and I am certainly not suggesting that one tool should be used for everything. And I agree std::vector paired with std::find() or std::binary_search() may be more suited in this case - depending on what the data really is.
      singulars
    3. CO@sbi: actually the minimum O() performance is specified in the standard, so it is not just theory. I agree with you that if a std::vector suits the needs of the majority of the code the std::find(). But if the OP is only dealing with this list of numbers as set it would be good to use std::set() We should use the right tool for the job. std::set is the optimal tool for the problem the OP described. When the OP has to fit this problem into a larger piece of code std::set may not be the best tool for the job.
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload