best avoid arrayed std::shared_ptr in C++11

parent 783a4e92
......@@ -67,11 +67,12 @@ inline std::size_t get_file_size(const std::basic_string<typename fs::path::valu
* @param len: length in size of T
template <class T, class t_char = char>
std::pair<bool, std::shared_ptr<T[]>> get_file_mem(std::basic_istream<t_char>& istr, std::size_t offs, std::size_t len=1)
std::pair<bool, std::shared_ptr<T>> get_file_mem(
std::basic_istream<t_char>& istr, std::size_t offs, std::size_t len=1)
bool ok = true;
std::shared_ptr<T[]> ptr(new T[len]);
std::shared_ptr<T> ptr(new T[len], [](T *pt){ delete[] pt; });
return std::make_pair(false, ptr);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment