Forum Replies Created

Viewing 10 posts - 46 through 55 (of 55 total)
  • Author
    Posts
  • in reply to: C++ Insights #80373
    Driton Kuci
    Participant
        Up
        1
        Down
        ::

        Does any know, if there is any extension (or plug-in) in Visual Studio or Visual Studio Code in order to generate the same outputs as CPP Insights (especialy, the template instantiations)?
        Or maybe any other IDEs?

        Thank you in advance!

        in reply to: Virtual Destructor #78958
        Driton Kuci
        Participant
            Up
            0
            Down
            ::

            But that is my point, the destructor of Account is not virtual and in case of reference:
            const Account& aRef = BankAccount(200.0);

            Both destructors are invoked:
            ~BankAccount()
            ~Account()

            Is my example not correct?

            in reply to: cpp stories example #63326
            Driton Kuci
            Participant
                Up
                1
                Down
                ::

                Hi jleko,

                initB() is called for t1( 10 ) because member variable std::string b has a default value (i.e., the return value of function initB() ).

                In this case you provide the value only for member variable int a (i.e., 10), so no need to assign its default value (i.e., the return value of function initA() ).
                But for member variable std::string b value is provided, thus compiler sets its default value.

                You can have a look here: https://cppinsights.io/s/3a7243e2
                Specially at lines: 20-22 and 26-28  where the Ctors are declared.

                 

                Best Regards,
                Driton

                in reply to: Function overloading on return type #58903
                Driton Kuci
                Participant
                    Up
                    0
                    Down
                    ::

                    Hi Tobias,

                    thank you for your comments.

                    You are right, I could specialize the template functions outside the class definition and it would look like this: https://godbolt.org/z/fxqYjzv57

                    I am used to complete the template stuff within the class and the header file of course.

                    in reply to: Wrong lambda sizes #58902
                    Driton Kuci
                    Participant
                        Up
                        0
                        Down
                        ::

                        Hi Tobias,
                        thank you for your hint.

                        It seems that it is an error/bug by IDE Visual Studio 2022 because I can compile and even run the application.
                        The warning messages show also the correct padding Bytes added at the end of the variables.

                        But the static_assert method remains red underlined and if you hover it, it shows the error message.
                        But, as I said, I can run the application and it shows the correct sizes:

                        sizeof( l ):   12
                        sizeof( l2 ): 8

                        Driton Kuci
                        Participant
                            Up
                            0
                            Down
                            ::

                            Hi Luiz,

                            should you not reserve as much memory as the number of elements you want to emplace in to the vector (to avoid reallocation)?

                            I mean:

                            std::vector<T> myVec;
                            myVec.reserve(1’000’000’000);
                            myVec.emplace_back(T(1’000’000’000));

                            in reply to: (Non)const local variable and move it or not #11345
                            Driton Kuci
                            Participant
                                Up
                                0
                                Down
                                ::

                                But, if both methods f1 and f2 can be used, which one should I prefer and implement?
                                By which method we get a higher profit (related to performance, speed, optimization, etc.)?

                                in reply to: Data generated at compile time #10063
                                Driton Kuci
                                Participant
                                    Up
                                    0
                                    Down
                                    ::

                                    But let say I need the whole vector at run-time, with all of its elements, even if they are more than thousand (maybe a bad design but I need it).
                                    Let assume that vector occupies of 1kB memory.

                                    1. Does this mean that the executable file has a larger size for 1kB, due to this vector?
                                    2. Theoritically, if we need 10’000 such std::vectors (I know, it is bad design), does it mean that the executable file is 10’000 times larger?

                                     

                                    Driton Kuci
                                    Participant
                                        Up
                                        0
                                        Down
                                        ::

                                        But the object mDoble3 will be initialized at run-time, correct?
                                        How can static_assert and decltype evaluate the types/expression at compile-time for the object mDoble3?

                                        in reply to: Structured Binding: further example #10043
                                        Driton Kuci
                                        Participant
                                            Up
                                            0
                                            Down
                                            ::

                                            Did you forget the share the code ;-)?

                                          Viewing 10 posts - 46 through 55 (of 55 total)