Hi,
I'm on C++11, is it possible from decltype to determine which type the call operator must use as return type from std::tuple? The testing code:
#include <iostream>
#include <tuple>
using...
Type: Posts; User: frank67
Hi,
I'm on C++11, is it possible from decltype to determine which type the call operator must use as return type from std::tuple? The testing code:
#include <iostream>
#include <tuple>
using...
Thanks for your answer, but memory leak happens the same if not catch:
#include <iostream>
void exercise()
{
throw 1; // memory leak
}
int main()
Hi,
I'm trying to throw an exception without a memory leak happens.
Googling I found this FAQ:
https://isocpp.org/wiki/faq/exceptions#why-not-exceptions
where I read: "Throwing an exception will...
Do you mean that way?
#include <iostream>
#include <vector>
#include <iterator>
using namespace std;
struct istream_si
{
What's wrong about this source code?
#include <iostream>
#include <vector>
#include <iterator>
using namespace std;
int main()
{
I'm grateful with you to enlighten me with your answers :) I carefully read the post and as a consequence of this sentence:
Googling I discovered that cppreference says since C++11...
I'm a bit confused when trying to figure out the implementation of a converting ctor. I wrote this source:
#include <iostream>
#include <stdexcept>
using namespace std;
class tinyInt { ...
Maybe I misunderstood the exercise but I chose variadic template as possible solution, now I'm not able to go forward because I don't know how to specialize the variadic for const char* type.
The...
I hope to quickly end these exercises:devil:, although it works fine without it has been asked to write a specialization of the variadic template Element_cnt in order to be called for const char*...
No, nothing to say it's clear now. Instead could I have confirmation about that std::forward act as std::move on t2?
t2 is bound to the literal 42 that is a rvalue therefore std::forward returning...
The number 2 because &j is bound to z passed as lvalue via std::forward
Any further comments?
Yep! my mistakes (I played with the code too much:redface:) the definition of g function at line 13 has changed, then I correct the typo at line 10 (thanks Elysia) in second parameter of the function...
I'm a bit confused :confused: about type conversions in this exercise so I hope someone will enlighten me. C++ is a statically typed language therefore types must match otherwise conversion rules...
I agree, admitting that opensource tools suit my needs which is a good one? Maybe Qt-Creator, I thought...:frown:
I have to buy too many things before to be able to coding with Visual Studio, since C++ is a standard (not proprietary) I think that opensource tools are good enought to accomplish this.
Me too I...
Up to now I'm dealing with the exercises of the book C++ Primer maybe it could be helpful in the future, I don't know
it does
maybe it does; I should check
Does your IDE also checks for...
I haven't an IDE GUI based I wrote code with Visual IMproved in cascade with valgrind they fit my needs, up to now...:)
I learned to use static_assert for these matters, with this code:
#include...
The exercise asked for: "Write a version of sum with a return type that is guaranteed to be large enough to hold the result of the addition."
Therefore I wrote this code:
#include <iostream>...
Yes, I've already tried typeid but I discarded just because it doesn't print a well understandable output for built-in types.
I guess the only way is to use the is_same class as in this link:...
I'd like to print remove_pointer::type member's value. This is the code:
#include <iostream>
#include <type_traits>
using namespace std;
int main()
{
unsigned u(1);
string...
:eek: I didn't realize that those were copy-control members function template, thanks Laserlight!
Out of curiosity, supposing this is the deleter:
class DebugDelete {
public:
DebugDelete(ostream& s = cerr): os(s) { }
template<typename T> void operator()(T* ptr) const...
Does anybody know whether there are software for template debugging/profiling like this one Templight for Debian 8.x GNU Linux? Which program should I have to use?
Thanks in advance
I've checked on the book, for the owners look §14.1 at "Choosing member or non-member implementation"
It explain that for symmetric operator like arithmetic it's usual deal with mixed type for...
Cpp Primer 5th Edition this one: https://play.google.com/store/books/details/Stanley_Lippman_C_Primer?id=J1HMLyxqJfgC