CPP's questions about runtime and compile time

CPP says compile time determination and run time determination how should I understand, static and dynamic types inherited by
are easy to understand, static type compilation time is determined, and dynamic type runtime is determined.
when it comes to the explanation of unique_ptr and shared_ptr, shared_ptr passes in the custom delete calling object through the second parameter, that is, it jumps to the specified code to run at run time.
while unqiue_ptr uses the template parameter, although the type is determined at compile time, the second parameter that needs to be passed in is a calling object. Don"t you need the runtime to jump to the specified code to run? why is it said in
primer that shared_ptr is run time and unqiue is compile time?

I find it difficult for primer to go back to Chapter 16, and it doesn"t feel difficult in front of me.

Jul.06,2021

The main reason for

is that unique_ptr is lighter than shared_ptr and has no runtime burden, so the deleter of unique_ptr is determined at compile time.

two unique_ptr belong to different types even if they point to the same type and if the deleter is different. The deleter of unique_ptr is already built into the type, so you don't need to store a deleter object to know where the deleter is. The "type embedding" process is determined at compile time, and the code for the deletion process is, of course, run at run time.

Unlike

shared_ptr , the constructor passes in a real object that is stored for use. The "object Storage" procedure is determined by the run time, and the code that deletes the process is, of course, run at run time. shared_ptr is more flexible.


Is there any essential difference in the definition of

?

template< class Y, class Deleter > 
shared_ptr( Y* ptr, Deleter d );

template<
    class T,
    class Deleter = std::default_delete<T>
> class unique_ptr;
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4c044-44607.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4c044-44607.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?