#include <iostream>
#include <memory>
using namespace std;
namespace hikky {
template < class Type, class Del = default_delete< Type> >
class unique_ptr {
public :
typedef Type element_type;
typedef Del deleter_type;
typedef Type pointer;
unique_ptr ( ) ;
unique_ptr (
nullptr_t _Nptr
) ;
explicit unique_ptr (
pointer _Ptr
) ;
unique_ptr (
pointer _Ptr,
typename conditional<
is_reference< Del> :: value ,
Del,
typename add_reference< const Del> :: type
> :: type _Deleter
) ;
unique_ptr (
pointer _Ptr,
typename remove_reference< Del> :: type && _Deleter
) ;
unique_ptr (
unique_ptr && _Right
) ;
template < class Type2, class Del2>
unique_ptr (
unique_ptr< Type2, Del2> && _Right
) ;
~unique_ptr ( ) ;
unique_ptr& operator= (
unique_ptr && _Right
) ;
template < class Type2, class Del2>
unique_ptr& operator= (
unique_ptr< Type2, Del2> && _Right
) ;
void swap (
unique_ptr& _Right
) ;
pointer release ( ) ;
void reset (
pointer _Ptr = pointer( )
) ;
pointer get ( ) const ;
Type& operator* ( ) const ;
pointer operator- > ( ) const ;
Del& get_deleter ( ) ;
const Del& get_deleter ( ) const ;
explicit operator bool ( ) const ;
unique_ptr(
const unique_ptr& _Right
) = delete ;
unique_ptr& operator= (
const unique_ptr& _Right
) = delete ;
private :
pointer stored_ptr; // exposition only
Del stored_deleter; // exposition only
} ;
}
int main( ) {
// your code goes here
return 0 ;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWVtb3J5Pgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKbmFtZXNwYWNlIGhpa2t5IHsKCnRlbXBsYXRlPGNsYXNzIFR5cGUsIGNsYXNzIERlbCA9IGRlZmF1bHRfZGVsZXRlPFR5cGU+ID4KICAgIGNsYXNzIHVuaXF1ZV9wdHIgewoKcHVibGljOgogICAgICAgIHR5cGVkZWYgVHlwZSBlbGVtZW50X3R5cGU7CiAgICAgICAgdHlwZWRlZiBEZWwgZGVsZXRlcl90eXBlOwogICAgICAgIHR5cGVkZWYgVHlwZSBwb2ludGVyOwoKICAgICAgICB1bmlxdWVfcHRyICgpOwogICAgICAgIHVuaXF1ZV9wdHIgKAogICAgICAgICAgICBudWxscHRyX3QgX05wdHIKICAgICAgICApOwogICAgICAgIGV4cGxpY2l0IHVuaXF1ZV9wdHIgKAogICAgICAgICAgICBwb2ludGVyIF9QdHIKICAgICAgICApOwogICAgICAgIHVuaXF1ZV9wdHIgKAogICAgICAgICAgICBwb2ludGVyIF9QdHIsCiAgICAgICAgICAgIHR5cGVuYW1lIGNvbmRpdGlvbmFsPAogICAgICAgICAgICAgICAgaXNfcmVmZXJlbmNlPERlbD46OnZhbHVlLCAKICAgICAgICAgICAgICAgIERlbCwKICAgICAgICAgICAgICAgIHR5cGVuYW1lIGFkZF9yZWZlcmVuY2U8Y29uc3QgRGVsPjo6dHlwZQogICAgICAgICAgICA+Ojp0eXBlIF9EZWxldGVyCiAgICAgICAgKTsKICAgICAgICB1bmlxdWVfcHRyICgKICAgICAgICAgICAgcG9pbnRlciBfUHRyLAogICAgICAgICAgICB0eXBlbmFtZSByZW1vdmVfcmVmZXJlbmNlPERlbD46OnR5cGUmJiBfRGVsZXRlcgogICAgICAgICk7CiAgICAgICAgdW5pcXVlX3B0ciAoCiAgICAgICAgICAgIHVuaXF1ZV9wdHIgJiYgX1JpZ2h0CiAgICAgICAgKTsKICAgICAgICB0ZW1wbGF0ZTxjbGFzcyBUeXBlMiwgY2xhc3MgRGVsMj4KICAgICAgICAgICAgdW5pcXVlX3B0ciAoCiAgICAgICAgICAgICAgICB1bmlxdWVfcHRyPFR5cGUyLCBEZWwyPiAmJiBfUmlnaHQKICAgICAgICAgICAgKTsKCiAgICB+dW5pcXVlX3B0ciAoKTsKCiAgICB1bmlxdWVfcHRyJiBvcGVyYXRvcj0gKAogICAgICAgIHVuaXF1ZV9wdHIgJiYgX1JpZ2h0CiAgICApOwogICAgdGVtcGxhdGU8Y2xhc3MgVHlwZTIsIGNsYXNzIERlbDI+CiAgICAgICAgdW5pcXVlX3B0ciYgb3BlcmF0b3I9ICgKICAgICAgICAgICAgdW5pcXVlX3B0cjxUeXBlMiwgRGVsMj4gJiYgX1JpZ2h0CiAgICAgICAgKTsKICAgIHZvaWQgc3dhcCAoCiAgICAgICAgdW5pcXVlX3B0ciYgX1JpZ2h0CiAgICApOwogICAgcG9pbnRlciByZWxlYXNlICgpOwogICAgdm9pZCByZXNldCAoCiAgICAgICBwb2ludGVyIF9QdHIgPSBwb2ludGVyKCkKICAgICk7CgogICAgcG9pbnRlciBnZXQgKCkgY29uc3Q7CiAgICBUeXBlJiBvcGVyYXRvciogKCkgY29uc3Q7CiAgICBwb2ludGVyIG9wZXJhdG9yLT4gKCkgY29uc3Q7CiAgICBEZWwmIGdldF9kZWxldGVyICgpOwogICAgY29uc3QgRGVsJiBnZXRfZGVsZXRlciAoKSBjb25zdDsKICAgIGV4cGxpY2l0IG9wZXJhdG9yIGJvb2wgKCkgY29uc3Q7CgogICAgdW5pcXVlX3B0cigKICAgICAgICBjb25zdCB1bmlxdWVfcHRyJiBfUmlnaHQKKSA9IGRlbGV0ZTsKICAgIHVuaXF1ZV9wdHImIG9wZXJhdG9yPSgKICAgICAgICBjb25zdCB1bmlxdWVfcHRyJiBfUmlnaHQKKSA9IGRlbGV0ZTsKCnByaXZhdGU6CiAgICBwb2ludGVyIHN0b3JlZF9wdHI7ICAgIC8vIGV4cG9zaXRpb24gb25seQogICAgRGVsIHN0b3JlZF9kZWxldGVyOyAgICAvLyBleHBvc2l0aW9uIG9ubHkKfTsKfQoKaW50IG1haW4oKSB7CgkvLyB5b3VyIGNvZGUgZ29lcyBoZXJlCglyZXR1cm4gMDsKfQ==
compilation info
prog.cpp:28:13: error: template argument 3 is invalid
>::type _Deleter
^
prog.cpp:24:22: error: expected nested-name-specifier
typename conditional<
^
prog.cpp:28:21: error: expected unqualified-id before ‘_Deleter’
>::type _Deleter
^
prog.cpp:28:21: error: expected ‘)’ before ‘_Deleter’
prog.cpp:28:16: error: expected ‘;’ at end of member declaration
>::type _Deleter
^
prog.cpp:28:21: error: ‘_Deleter’ does not name a type
>::type _Deleter
^
stdout