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

Search:

Type: Posts; User: monarch_dodra

Page 1 of 80 1 2 3 4

Search: Search took 0.07 seconds.

  1. Re: Memory leak suspicion at resizing of dynamic array

    A pointer contains only an address of 1 element. This and nothing else. The pointer itself will not know if it points to a single value, or an array of values, and it will not know how many elements...
  2. Re: Is stdext::hash_map's thread safe in free run environment?

    That won't work with a container. atomics typically work with primitive types. For more complex types, an atomic will basically only support get and set. And both of these will be "pass by value". So...
  3. Replies
    5
    Views
    147

    Re: Validating a Float

    Have you been tasked with re-inventing the logic for that? If not, you can use:
    - istream's operator>> http://en.cppreference.com/w/cpp/io/basic_istream/operator_gtgt
    - string's "sto" functions...
  4. Re: Is stdext::hash_map's thread safe in free run environment?

    "stdext::hash_map" ? Why not use std::unordered_map ?

    Anyways sa rule of thumb, containers are not thread safe. But there is a set of things you *can* do which are guaranteed safe:

    - All calls...
  5. Re: Using malloc and free instead of new and delete in C++

    I hope so...
  6. Re: concatenate int value from vector to long long int

    Well, "those work for me" is never proof of anything :) I was using godbolt to test different compiler versions, always with C++11 exclusively (-std=c++11).

    Anyways, it would appear gcc accepts...
  7. Re: Using malloc and free instead of new and delete in C++

    This is not correct. This does not "contruct" the v. It *copies* the v. This is a fundamentally different notion in C++. Copying something over not-yet-initialized is undefined behavior for anything...
  8. Re: concatenate int value from vector to long long int

    Those work for me though, as you can always pass a const expression to functions taking const refs.

    I can see it being an issue if you want to pass your x to a value taking by const pointer though.
  9. Re: concatenate int value from vector to long long int

    I'm not sure that is right, as Cn is never ODR-used to begin with, meaning it does not need to be captured at all. Clang also seems to accept it.

    I found this bug report, though it hasn't been...
  10. Re: concatenate int value from vector to long long int

    I don't know what the speck say exactly, but given that Cn is const and compile time known, I do not think you need to capture it. Rather, it gets "baked" into the lambda. The code you posted works...
  11. Re: concatenate int value from vector to long long int

    You should also consider using accumulate. It takes care of a few more details for you, such as not having to create a variable to accumulate into, or creating a capture in your lambda:


    #include...
  12. Replies
    12
    Views
    253

    Re: Divide 1d vector into 2d vector

    consexpr is a way of saying that the variable is declared "const", so that no-one may change it. "constexpr" further means the variable's value is known at compile time, allowing the compiler to use...
  13. Replies
    3
    Views
    174

    Re: cin statement

    What you see is something usually called a "console". Honestly, C++ (and C) know nothing about it. All they know is they have a input stream (stdin/std::cin) and a output stream (stdout/std::cout)....
  14. Re: How to use C++ Boots installation and map serialization?

    It's called *BOOST*. Not "BOOTS".

    Not 100% sure but: You wrote the serialization code for your bank, which serializes the map of accounts. But how does it know how to serialize the accounts...
  15. Re: C++ Console Even/Odd Control Without %,/,+ and -

    Ah. Missed that. Thanks.
  16. Re: C++ Console Even/Odd Control Without %,/,+ and -

    Also, note that all the solutions provided so far (mine included) are string based. Why not operate on actual numbers? You can easily test for parity with a bit tests (not forbidden according to...
  17. Re: C++ Console Even/Odd Control Without %,/,+ and -

    Alternativelly, a lookup array (poor man's hash table) also works.

    You can use a "const char*" to save on the space used by the array, at the cost of not using std::string:


    #include...
  18. Re: Obtaining a value from a std::set and letting it be a variable.

    The issue is not the containers in and out of themselves, but rather, the "raw" pointers: With raw pointers, it is that it is not clear who "owns" the pointer, and who is responsible for deleting...
  19. Replies
    4
    Views
    560

    Re: Help with structs

    Is that the actual code you you are using? It doesn't even compile. What is "f"? What is "homies"?

    Your question seems to imply the code you have at the very least compiled and ran.

    Please post...
  20. Re: Advice for extracting, converting data

    At the end of the day, it really depends on how the format is defined. Another option to consider is:

    Reading each line, using a regex to capture tokens of interest, and then using boost...
  21. Re: Passing stack variable by addresses to other object

    The spec guarantees that the objects' lifetime will last until the function returns. They *will* be destroyed *after* the function returns. Also, you may only pass temporary variables by reference if...
  22. Re: I need a way to skip in this function.

    You should straight up return after making a move (recommended). Either that, or make all those "if" "else if"s.
  23. Re: Obtaining a value from a std::set and letting it be a variable.

    You don't want to do that. You are going to run either into memory management issues, or un-maintainable code, VERY quickly.

    You probably want to store your objects in std::shared_ptr's, and pass...
  24. Re: Inconsistency in the comparator outcome?

    Right, agreed. I'm just saying that if the original expectation was "if the total cost is close enough, order according to some other criteria", this is something that would virtually never happen....
  25. Re: Inconsistency in the comparator outcome?

    I advise against using an epsilon in an operator, as you'd lose the transitive property of the operator. For example, you could have a==b and b == c, but you'd have a < c. And for operations such as...
Results 1 to 25 of 2000
Page 1 of 80 1 2 3 4


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a Codeguru.com survey!


HTML5 Development Center