#include <iostream>
#include <memory>

auto makeUnique(std::string s) {
    return std::make_unique<std::string>(s);
}

int main() {
    auto unique = makeUnique("Hello world!");
    
    // convert unique pointer to shared pointer
    std::shared_ptr<std::string> shared = std::move(unique);
    
    std::cout << *shared << std::endl;
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: