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

Search:

Type: Posts; User: laserlight

Page 1 of 80 1 2 3 4

Search: Search took 0.12 seconds.

  1. Re: A question regarding throwing an exception

    If you comment out the throw 2, then when the lifetime of A ends because it goes out of scope, its destructor is invoked, leading to throw 1, which is then caught.


    Sorry, typo error. It should...
  2. Re: A question regarding throwing an exception

    It only catches the exception thrown at throw 1. When that happens, the destructor is invoked, causing the exception from throw 1 to be thrown and not caught.
  3. Re: A question regarding throwing an exception

    True. However, if you are throwing exceptions from a destructor in order to catch it in that destructor, then you are probably misusing exceptions.


    Yes. This is mentioned in the article.
  4. Re: A question regarding throwing an exception

    Read: GotW #47: Uncaught Exceptions. Basically, you should not be throwing an exception from within a destructor.
  5. Replies
    32
    Views
    628

    Re: Is this guaranteed to be correct?

    As in the cost of typeid and conversion to std::type_index was too high?
  6. Re: How to scan file bytes using istreambuf_iterator iit(f);

    char, signed char and unsigned char can all be used to store "bytes", but the latter tends to be the best option when you will do things like bit shifting.


    You may need to use...
  7. Replies
    1
    Views
    366

    Re: Code Cutting Help

    A and B are related, if not the same thing. To determine this, one should measure, e.g., run the alternative versions of the code with typical input on typical hardware repeatedly to obtain timings...
  8. Replies
    3
    Views
    245

    Re: c++ statistics code

    Wikipedia has a list of numerical libraries with a C++ section that you can check out.
  9. Replies
    4
    Views
    233

    Re: Parsing in C/C++

    They are indeed separate forums, which is why you should ask only on one of them, moving on to another only if you have not received any replies after some reasonable length of time.
  10. Replies
    4
    Views
    233

    Re: Parsing in C/C++

    This has been asked and answered elsewhere.
  11. Replies
    27
    Views
    1,084

    Re: passing smart pointer

    In practice, this is sound advice, but I note that in this case the name is in the namespace of the class, so it does not actually violate the rule, though it poses an unnecessary risk.
  12. Replies
    5
    Views
    290

    Re: Constructor with lots of parameters

    Oh yes, I missed that. I would use a std::unique_ptr, but there seems to be no equivalent in Qt. Since there's no move constructor either, it looks like you have three choices:

    Use a...
  13. Re: Do i need to deep copy container object?

    Reading docs that I found online, it seems that QScopedPointer is not copyable. This makes sense since it is neither "shared" nor "unique" but rather is "scoped". Since Test has a member of type...
  14. Replies
    5
    Views
    290

    Re: Constructor with lots of parameters

    I think that that will work: the call to take() should be effectively giving you move semantics, which is desirable in this case.
  15. Replies
    5
    Views
    290

    Re: Constructor with lots of parameters

    Considering the fact that you store a QScopedPointer<Data> object rather than a Data object as a member in Device makes me think that Data is an abstract base class. As such, you should not be...
  16. Replies
    27
    Views
    1,084

    Re: passing smart pointer

    Is it possible that the Record object might be destroyed yet a Test object holding a pointer to it might still exist?
  17. Re: operator > overloading for derived classes

    No, I meant what I wrote ("..."). Beyond that, it is up to you how you want to implement the function.


    No real difference since it does not matter to the caller whether or not you modify p_data,...
  18. Re: operator > overloading for derived classes

    I suggest something like this instead:

    class Data
    {

    // ...

    virtual void Serialize(QDataStream& stream) const
    {
    stream << x;
  19. Re: operator > overloading for derived classes

    In the Data class, declare virtual member functions to perform serialisation. Overload these operators to perform serialisation for the Data class hierarchy by calling these member functions. For...
  20. Re: Noob needs easy help with command line interface

    Poke around in your IDE's project configuration and other settings and you will find the place where you can enter command line arguments via your IDE.

    You can also open a separate command prompt...
  21. Replies
    3
    Views
    276

    Re: How to clone an object in C++?

    I suggest this instead:

    class CBaseClass
    {
    public:
    // ...

    virtual CBaseClass* Clone() const
    {
    return new CBaseClass(*this);
  22. Replies
    19
    Views
    888

    Re: C++ with OOP assignment

    You can access them from the object itself, so I do not see an issue for static members. Besides, I thought that the main reason why they are common for singleton implementations is that the function...
  23. Thread: boost::bind

    by laserlight
    Replies
    2
    Views
    183

    Re: boost::bind

    Read the Boost.Bind documentation. For example, it states:

    There are also notes about MSVC that suggest that this does work on MSVC8.
  24. Replies
    8
    Views
    443

    Re: anonymous namespace qualifier

    It looks like it will be allowed in C++14, but since ::f is a name from the global namespace, this still will not help for monarch_dodra's case of a name from an unnamed namespace.
  25. Replies
    19
    Views
    888

    Re: C++ with OOP assignment

    Possibly. It would also be necessary to disable copying to avoid problems with say, function templates and maybe the C++11 use of auto, but that is bog standard for implementations of the singleton...
Results 1 to 25 of 2000
Page 1 of 80 1 2 3 4


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center