Skip to content

Commit

Permalink
Add a type alias for a free-ing unique_ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvb committed Mar 30, 2017
1 parent 488e001 commit e91997e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions core/utility.h++
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,17 @@

#include "core/string.h++"

#include <memory>

#include <cstdlib>

namespace skui
{
namespace core
{
template<typename T>
using unique_free_ptr = std::unique_ptr<T, decltype(&std::free)>;

#ifdef _WIN32
string convert_to_utf8(const std::wstring& utf16_string);
std::wstring convert_to_utf16(const string& utf8_string);
Expand Down
2 changes: 1 addition & 1 deletion gui/window_xcb.c++
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace skui
using xdisplay_ptr = std::unique_ptr<Display, decltype(&XCloseDisplay)>;
using xvisualinfo_ptr = std::unique_ptr<XVisualInfo, decltype(&XFree)>;
using xstring_ptr = std::unique_ptr<char, decltype(&XFree)>;
using xcb_intern_atom_reply_ptr = std::unique_ptr<xcb_intern_atom_reply_t, decltype(&free)>;
using xcb_intern_atom_reply_ptr = core::unique_free_ptr<xcb_intern_atom_reply_t>;

class platform_handle
{
Expand Down

0 comments on commit e91997e

Please sign in to comment.