C++ Logo

std-discussion

Advanced search

Re: Is there any way to override constructors for primitive types?

From: Peter C++ <peter.cpp_at_[hidden]>
Date: Wed, 19 Feb 2020 13:00:53 +0100
One can wrap those types in classes (using struct) and implement according constructors and overloaded operators. However at a loss of efficiency when passing as value parameters if the destructors are non-trivial (with Output it is)

I have no problem explaining lifetime ending at }

Only later, when class types are introduced I show that once using a tracer class without member variables.

I suggest you learn C++ well, before starting to teach it.



sent from a mobile device so please excuse strange words due to autocorrection.
Peter Sommerlad
peter.cpp_at_[hidden]
+41-79-432 23 32

> On 18 Feb 2020, at 16:47, Vishal Oza via Std-Discussion <std-discussion_at_[hidden]> wrote:
>
> 
> Is there any way to override constructors for primitive types? If there is what is the way to do that. If not I would like to purpose a way to do that is a future standard. The reason way is to teach how C++ works from writing simple code by logging constructor and destructor calls of even primitive object without changing the object themselves
> Vishal Oza
> --
> Std-Discussion mailing list
> Std-Discussion_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion

Received on 2020-02-19 06:03:41