nerds-central

- friends
316 link karma
190 comment karma
send messageredditor for
what's this?

TROPHY CASE


  • Three-Year Club

    Verified Email

C++11: Future Chaining For Easy, Highly Threaded Execution by cassandravoitonin cpp

[–]nerds-central 0 points1 point ago

Thanks for pointing that out - fixed a few.

C++11: Future Chaining For Easy, Highly Threaded Execution by cassandravoitonin cpp

[–]nerds-central 2 points3 points ago

Try replacing the spinning loop with a wait:

this_thread::sleep_for(chrono::seconds(1));

The effects are quite interesting as you get to see the size of the underlying thread pool.

Eight C++ programming mistakes the compiler won’t catch by Andrey_Karpov_Nin cpp

[–]nerds-central -1 points0 points ago

If you use pointers rather than references, IE the vector is a vector of pointers and you pass the pointers around, you don't get the problem. Storing a vector of non trivial items (rather than pointers to them) is likely to cause problems.

Wow: shared_ptr is very slow, is there an alternative? by code-dogin cpp

[–]nerds-central 0 points1 point ago

Yes but that does not fix all cases. Sometimes you might neex to have multiple ownership which cannot be resolved at compile time.

Wow: shared_ptr is very slow, is there an alternative? by code-dogin cpp

[–]nerds-central -1 points0 points ago

You are right except that the code comes from a bigger project where all types which were legal in the implementation of the dsl were typedef so it was consistent and thus easier to code.

Wow: shared_ptr is very slow, is there an alternative? by code-dogin cpp

[–]nerds-central 0 points1 point ago

That is what I siad so I guess I agree with you.

Wow: shared_ptr is very slow, is there an alternative? by code-dogin cpp

[–]nerds-central 0 points1 point ago

not a bad idea, but it requires more work. How about just making a version of counted_ptr which uses intrusive_ptr.

view more: next