Question: I am trying to get a webpage to load when the date and time are correct. The code I have come up with is:

```
@echo off
:repeat
set CurrentTime=%time:~0,2%.%time:~3,2%
set CurrentDate=%date:/=-%
echo.
echo %CurrentDate% %CurrentTime%
echo.
IF %CurrentTime% == Tue 08-04-2014 13.04 goto load
timeout /t 1 >nul
goto repeat
:load
start/MAX iexplore.exe"" "http://www.youtube.com.au"
timeout /t 6 >nul

```

It will work if I remove the CurrentDate and the date from the IF statement but it won't if I don't. I do need the date and time to work.
Thanks.

Answer: 
It'll work if you use the C++14 `make_unique` or write your own one like in Yakk's answer. Basically the difference between the shared pointer behavior is that you got:

```
template<
    class T,
    class Deleter = std::default_delete<T>
> class unique_ptr;

```

for `unique_pointer` and as you can see, the deleter belongs to the type. If you declare a `unique_pointer<Base>` it'll always use `std::default_delete<Base>` as default. But `make_unique` will take care of using the correct deleter for your class.

When using `shared_ptr` you got:

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

```

and other overloads as constructor. As you can see the default deleter for `unique_ptr` depends on the template parameter when declaring the type (unless you use `make_unique`) whilst for `shared_ptr` the deleter depends on the type passed to the constructor.

---

You can see a version that allows polymorphic delete without virtual destructor [here](http://coliru.stacked-crooked.com/a/5ef08f9761e950ed) (this version should also work in VS2012). Note that it is quite a bit hacked together and I'm currently not sure what the behavior of `unique_ptr` and `make_shared` in C++14 will be like, but I hope they'll make this easier. Maybe I'll look into the papers for the C++14 additions and see if something changed if I got the time later.
```
template<typename T>
using smart_unique_ptr=std::unique_ptr<T,void(*)(void*)>;

template<class T, class...Args> smart_unique_ptr<T> make_smart_unique(Args&&...args) {
  return {new T(std::forward<Args>(args)...), [](void*t){delete (T*)t;}};
}

```

The problem is that the default deleter for `unique_ptr` calls `delete` on the stored pointer. The above stores a deleter that knows the type at construction, so when copied to base class `unique_ptr` will still delete as the child.

This adds modest overhead, as we have to dereference a pointer. In addition it denormalizes the type, as default constructed `smart_unique_ptr`s are now illegal. You can fix this with some extra work (replace a raw function pointer with a semi smart functor that at least does not crash: the function pointer, however, should be asserted to exist if the `unique` is non-empty when the deleter is invoked).