CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: wolle

Page 1 of 27 1 2 3 4

Search: Search took 0.02 seconds; generated 24 minute(s) ago.

  1. Replies
    10
    Views
    485

    Re: wait .. no blocking

    I often use a thread-safe producer-consumer queue for this kind of situation. The producer thread pushes information on the queue and the consumer thread pops it, either by active polling or waiting...
  2. Thread: array of objects

    by wolle
    Replies
    14
    Views
    821

    Re: array of objects

    The problem is that MyClass is not copyable because of the heap-allocated array held by the arr-pointer. And, as mentioned in #11, it gets copied here (underlined),



    myThs[i] =...
  3. Replies
    4
    Views
    326

    Re: threads and function call

    The Add function itself is thread-safe in the sense that it is reentrant in the right way,

    https://en.wikipedia.org/wiki/Reentrancy_(computing)

    It means you can call it pretty much as you like...
  4. Re: Is there a function intended to split strings by a delimiter in VC++?

    Yes, I wish I had come up with it myself :).

    I found it in the answer here,

    https://stackoverflow.com/questions/48402558/how-to-split-a-stdstring-into-a-range-v3-of-stdstring-views
  5. Re: Is there a function intended to split strings by a delimiter in VC++?

    Even simpler still. I found a way to get rid of the temporary string.

    No string constructor accepts the loop variable e directly. But e can deliver the starting address and length of a char...
  6. Re: Is there a function intended to split strings by a delimiter in VC++?

    I guess we need to be patient. Rome wasn't built in one day!
  7. Re: Is there a function intended to split strings by a delimiter in VC++?

    The code in my post #4 is directly from cppreference.com so either they or VS 2019 has it wrong.

    Anyway, using your suggestion I got this to work in VS 2019 (latest download),



    #include...
  8. Re: Is there a function intended to split strings by a delimiter in VC++?

    C++ 20 has a new feature called ranges. It has a function for splitting called std::ranges::split_view,

    https://en.cppreference.com/w/cpp/ranges/split_view/split_view

    I tried the last part of...
  9. Replies
    3
    Views
    798

    Re: Intersecting number ranges

    This is my motivation for the reduction of the first set of parentheses in #2:

    Say you have two intervals [dbstart .. dbend] and [paramstart .. paramend] and want to know if they overlap.

    You...
  10. Replies
    8
    Views
    1,071

    Re: Stopping unnecessary style corrections

    Generally, I find VS 2019 a little too complex and invasive for my taste so I've contemplated switching to VS Code for quite some time.

    But now I see VS 2022 is on the brink of being released and ...
  11. Replies
    3
    Views
    798

    Re: Intersecting number ranges

    If you are allowed to use parentheses () you could "break out" dbend >= 19010101 and dbend = 0 and get the following:


    dbend >= 19010101 and (dbstart >= paramstart and dbend <= paramend or...
  12. Re: Exercises that programmers should do to avoid back and neck pain

    How do you recognize a programmer in a crowd?

    It's the fit-looking individual who's juggling the heavy reference manuals of today as easily as if they were teeny-weeny language descriptions from...
  13. Replies
    17
    Views
    3,670

    Re: Find cartesians for matrix elements

    I find it intriguing that the greedy algorithm I used in #17 works so well. I decided to check out whether it was just luck with the choice of input matrixes. So this time, I generate the input...
  14. Replies
    17
    Views
    3,670

    Re: Find cartesians for matrix elements

    I've had another look at this problem, and it seems to be a variation of the (exact) set cover problem:

    https://en.wikipedia.org/wiki/Set_cover_problem

    Here, the problem has the additional...
  15. Replies
    17
    Views
    3,670

    Re: Find cartesians for matrix elements

    You can always apply exhaustive combinatorics:

    1. Systematically generate all Cartesian matrixes that may occur in any matrix the size of the input matrix. Select those that are present in the...
  16. Re: Rookie query about short and byte arithmetic/bitwise ops

    They know, and they call it the C# type promotion rules. It can give "somewhat unexpected results" mentioned here,

    https://prasadiapsara.wordpress.com/2013/07/21/csharp-type-promotion-rules/

    To...
  17. Thread: C++ Books

    by wolle
    Replies
    3
    Views
    19,968

    Sticky: Re: C++ Books

    Here is an open-access research article called "Thriving in a crowded and changing world: C++ 20062020". The author is no less than Bjarne Stroustrup, the founder of C++. Even if it is not a book,...
  18. Re: What is the counterpart of this C pointer programme in C#?

    In exceptional situations, there is yet another option. You can mix C# and native C++ using C++/CLI as a bridge. At least in theory. I haven't done it, so I cannot vouch for it.
  19. Re: What is the counterpart of this C pointer programme in C#?

    One of the main goals of both Java and its follow-up C# is to be resilient to programmer errors. For this reason, you cannot do things like &i and *p. Explicit references and pointers were deemed...
  20. Re: Knight's tour, recursion, dynamic programming, optimization

    But the Knight's tour can be formulated as an optimization problem, so I guess my claim is wrong.

    One can define the distance between two squares as the fewest moves it takes for the knight to go...
  21. Replies
    1
    Views
    5,588

    Re: What is GCC High?

    What you write can be found verbatim here,

    https://www.boardworld.com.au/forums/viewthread/28006/

    So either you are also Paul Wilson, or you are plagiarizing someone else, which is fraudulent....
  22. Replies
    1
    Views
    1,656

    Re: N+1 SELECT problem in Hibernate

    Here's someone who claims to have a solution,

    https://www.sipios.com/blog-tech/eliminate-hibernate-n-plus-1-queries

    I haven't heard about this problem before. But if it's a common inefficiency,...
  23. Thread: C++ IDE Query

    by wolle
    Replies
    5
    Views
    992

    Re: C++ IDE Query

    In my view, it can be a good thing to first go through the process of learning how to use the different individual tools involved in program development. Then when you start using an IDE you are in a...
  24. Re: Knight's tour, recursion, dynamic programming, optimization

    Dynamic programming is an optimization method and as such is used when you are looking for what is best in some sense. It could be to find the shortest or the cheapest of something. But that does not...
  25. Replies
    4
    Views
    3,054

    Re: Stupid Things Developers Do

    The easiest way to be stupid as a programmer is trying too hard to be smart. Spending lots of time reducing a straightforward algorithm into something only Einstein could understand, to be able to...
Results 1 to 25 of 654
Page 1 of 27 1 2 3 4





Click Here to Expand Forum to Full Width

Featured