mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Replace shared_ptr/weak_ptr with STL's versions (#588)
* Replace shared_ptr/weak_ptr with stdlib counterparts * Fix ptr usage through tests compilation * Bring back dlib smart ptrs as legacy * Include scoped_ptr directly * Add explanation about smart_ptr deprecation
This commit is contained in:
parent
fe3e86a186
commit
74f9f2fb2a
@ -4,7 +4,7 @@
|
||||
#define DLIB_AnY_H_
|
||||
|
||||
#include "any_abstract.h"
|
||||
#include "../smart_pointers.h"
|
||||
#include "../smart_pointers/scoped_ptr.h"
|
||||
#include <typeinfo>
|
||||
|
||||
namespace dlib
|
||||
|
@ -4,7 +4,6 @@
|
||||
#define DLIB_AnY_DECISION_FUNCTION_Hh_
|
||||
|
||||
#include "any.h"
|
||||
#include "../smart_pointers.h"
|
||||
|
||||
#include "any_decision_function_abstract.h"
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
#define DLIB_AnY_FUNCTION_Hh_
|
||||
|
||||
#include "any.h"
|
||||
#include "../smart_pointers.h"
|
||||
|
||||
#include "any_function_abstract.h"
|
||||
|
||||
|
@ -4,7 +4,6 @@
|
||||
#define DLIB_AnY_TRAINER_H_
|
||||
|
||||
#include "any.h"
|
||||
#include "../smart_pointers.h"
|
||||
|
||||
#include "any_decision_function.h"
|
||||
|
||||
|
@ -5,6 +5,10 @@
|
||||
|
||||
#include "bayes_utils_abstract.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <ctime>
|
||||
#include <vector>
|
||||
|
||||
#include "../string.h"
|
||||
#include "../map.h"
|
||||
#include "../matrix.h"
|
||||
@ -13,11 +17,8 @@
|
||||
#include "../set.h"
|
||||
#include "../algs.h"
|
||||
#include "../noncopyable.h"
|
||||
#include "../smart_pointers.h"
|
||||
#include "../smart_pointers/scoped_ptr.h"
|
||||
#include "../graph.h"
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <ctime>
|
||||
|
||||
namespace dlib
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <string>
|
||||
#include "../pipe.h"
|
||||
#include "../threads.h"
|
||||
#include "../smart_pointers.h"
|
||||
#include "../smart_pointers/scoped_ptr.h"
|
||||
#include "../serialize.h"
|
||||
#include "../sockets.h"
|
||||
#include "../sockstreambuf.h"
|
||||
|
@ -4,6 +4,7 @@
|
||||
#define DLIB_BSP_CPph_
|
||||
|
||||
#include "bsp.h"
|
||||
#include <memory>
|
||||
#include <stack>
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
@ -330,7 +331,7 @@ namespace dlib
|
||||
|
||||
bool bsp_context::
|
||||
receive_data (
|
||||
shared_ptr<std::vector<char> >& item,
|
||||
std::shared_ptr<std::vector<char> >& item,
|
||||
unsigned long& sending_node_id
|
||||
)
|
||||
{
|
||||
|
@ -6,13 +6,14 @@
|
||||
#include "bsp_abstract.h"
|
||||
#include "../sockets.h"
|
||||
#include "../array.h"
|
||||
#include "../smart_pointers.h"
|
||||
#include "../smart_pointers/scoped_ptr.h"
|
||||
#include "../sockstreambuf.h"
|
||||
#include "../string.h"
|
||||
#include "../serialize.h"
|
||||
#include "../map.h"
|
||||
#include "../ref.h"
|
||||
#include "../vectorstream.h"
|
||||
#include <memory>
|
||||
#include <queue>
|
||||
#include <vector>
|
||||
|
||||
@ -207,7 +208,7 @@ namespace dlib
|
||||
|
||||
struct msg_data
|
||||
{
|
||||
shared_ptr<std::vector<char> > data;
|
||||
std::shared_ptr<std::vector<char> > data;
|
||||
unsigned long sender_id;
|
||||
char msg_type;
|
||||
dlib::uint64 epoch;
|
||||
@ -420,7 +421,7 @@ namespace dlib
|
||||
)
|
||||
{
|
||||
unsigned long id;
|
||||
shared_ptr<std::vector<char> > temp;
|
||||
std::shared_ptr<std::vector<char> > temp;
|
||||
if (receive_data(temp,id))
|
||||
throw dlib::socket_error("Call to bsp_context::receive() got an unexpected message.");
|
||||
}
|
||||
@ -459,7 +460,7 @@ namespace dlib
|
||||
unsigned long& sending_node_id
|
||||
)
|
||||
{
|
||||
shared_ptr<std::vector<char> > temp;
|
||||
std::shared_ptr<std::vector<char> > temp;
|
||||
if (receive_data(temp, sending_node_id))
|
||||
{
|
||||
vectorstream sin(*temp);
|
||||
@ -496,7 +497,7 @@ namespace dlib
|
||||
!*/
|
||||
|
||||
bool receive_data (
|
||||
shared_ptr<std::vector<char> >& item,
|
||||
std::shared_ptr<std::vector<char> >& item,
|
||||
unsigned long& sending_node_id
|
||||
);
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <map>
|
||||
#include "../smart_pointers.h"
|
||||
#include <memory>
|
||||
|
||||
namespace dlib
|
||||
{
|
||||
@ -105,7 +105,7 @@ namespace dlib
|
||||
// Make a separate ostringstream for each option group. We are going to write
|
||||
// the output for each group to a separate ostringstream so that we can keep
|
||||
// them grouped together in the final output.
|
||||
std::map<string,shared_ptr<ostringstream> > groups;
|
||||
std::map<string,std::shared_ptr<ostringstream> > groups;
|
||||
this->reset();
|
||||
while(this->move_next())
|
||||
{
|
||||
@ -173,7 +173,7 @@ namespace dlib
|
||||
out << _dT(ct,"Options:");
|
||||
|
||||
// Now print everything out
|
||||
typename std::map<string,shared_ptr<ostringstream> >::iterator i;
|
||||
typename std::map<string,std::shared_ptr<ostringstream> >::iterator i;
|
||||
for (i = groups.begin(); i != groups.end(); ++i)
|
||||
{
|
||||
// print the group name if we have one
|
||||
|
@ -3,12 +3,13 @@
|
||||
#ifndef DLIB_DIRECTED_GRAPH_KERNEl_1_
|
||||
#define DLIB_DIRECTED_GRAPH_KERNEl_1_
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "../serialize.h"
|
||||
#include "../noncopyable.h"
|
||||
#include "../std_allocator.h"
|
||||
#include "../smart_pointers.h"
|
||||
#include "../algs.h"
|
||||
#include <vector>
|
||||
#include "directed_graph_kernel_abstract.h"
|
||||
#include "../is_kind.h"
|
||||
|
||||
@ -357,18 +358,18 @@ namespace dlib
|
||||
private:
|
||||
friend class directed_graph_kernel_1;
|
||||
typedef std_allocator<node_type*,mem_manager> alloc_type;
|
||||
typedef std_allocator<shared_ptr<E>,mem_manager> alloc_edge_type;
|
||||
typedef std_allocator<std::shared_ptr<E>,mem_manager> alloc_edge_type;
|
||||
std::vector<node_type*,alloc_type> parents;
|
||||
std::vector<node_type*,alloc_type> children;
|
||||
std::vector<shared_ptr<E>,alloc_edge_type> edge_parents;
|
||||
std::vector<shared_ptr<E>,alloc_edge_type> edge_children;
|
||||
std::vector<std::shared_ptr<E>,alloc_edge_type> edge_parents;
|
||||
std::vector<std::shared_ptr<E>,alloc_edge_type> edge_children;
|
||||
unsigned long idx;
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
typedef std_allocator<shared_ptr<node_type>,mem_manager> alloc_type;
|
||||
typedef std::vector<shared_ptr<node_type>, alloc_type> vector_type;
|
||||
typedef std_allocator<std::shared_ptr<node_type>,mem_manager> alloc_type;
|
||||
typedef std::vector<std::shared_ptr<node_type>, alloc_type> vector_type;
|
||||
vector_type nodes;
|
||||
};
|
||||
|
||||
@ -574,7 +575,7 @@ namespace dlib
|
||||
p.children.push_back(&c);
|
||||
c.parents.push_back(&p);
|
||||
|
||||
p.edge_children.push_back(shared_ptr<E>(new E));
|
||||
p.edge_children.push_back(std::shared_ptr<E>(new E));
|
||||
c.edge_parents.push_back(p.edge_children.back());
|
||||
}
|
||||
catch (...)
|
||||
@ -632,7 +633,7 @@ namespace dlib
|
||||
{
|
||||
try
|
||||
{
|
||||
shared_ptr<node_type> n(new node_type);
|
||||
std::shared_ptr<node_type> n(new node_type);
|
||||
n->idx = nodes.size();
|
||||
nodes.push_back(n);
|
||||
return n->idx;
|
||||
|
@ -3,12 +3,13 @@
|
||||
#ifndef DLIB_GRAPH_KERNEl_1_
|
||||
#define DLIB_GRAPH_KERNEl_1_
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "../serialize.h"
|
||||
#include "../noncopyable.h"
|
||||
#include "../std_allocator.h"
|
||||
#include "../smart_pointers.h"
|
||||
#include "../algs.h"
|
||||
#include <vector>
|
||||
#include "graph_kernel_abstract.h"
|
||||
#include "../is_kind.h"
|
||||
|
||||
@ -291,16 +292,16 @@ namespace dlib
|
||||
private:
|
||||
friend class graph_kernel_1;
|
||||
typedef std_allocator<node_type*,mem_manager> alloc_type;
|
||||
typedef std_allocator<shared_ptr<E>,mem_manager> alloc_edge_type;
|
||||
typedef std_allocator<std::shared_ptr<E>,mem_manager> alloc_edge_type;
|
||||
std::vector<node_type*,alloc_type> neighbors;
|
||||
std::vector<shared_ptr<E>,alloc_edge_type> edges;
|
||||
std::vector<std::shared_ptr<E>,alloc_edge_type> edges;
|
||||
unsigned long idx;
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
typedef std_allocator<shared_ptr<node_type>,mem_manager> alloc_type;
|
||||
typedef std::vector<shared_ptr<node_type>, alloc_type> vector_type;
|
||||
typedef std_allocator<std::shared_ptr<node_type>,mem_manager> alloc_type;
|
||||
typedef std::vector<std::shared_ptr<node_type>, alloc_type> vector_type;
|
||||
vector_type nodes;
|
||||
};
|
||||
|
||||
@ -506,7 +507,7 @@ namespace dlib
|
||||
|
||||
n1.neighbors.push_back(&n2);
|
||||
|
||||
shared_ptr<E> e(new E);
|
||||
std::shared_ptr<E> e(new E);
|
||||
n1.edges.push_back(e);
|
||||
|
||||
// don't add this twice if this is an edge from node_index1 back to itself
|
||||
@ -571,7 +572,7 @@ namespace dlib
|
||||
{
|
||||
try
|
||||
{
|
||||
shared_ptr<node_type> n(new node_type);
|
||||
std::shared_ptr<node_type> n(new node_type);
|
||||
n->idx = nodes.size();
|
||||
nodes.push_back(n);
|
||||
return n->idx;
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "../image_transforms/assign_image.h"
|
||||
#include "../array.h"
|
||||
#include "style.h"
|
||||
#include "../smart_pointers.h"
|
||||
#include "../smart_pointers/scoped_ptr.h"
|
||||
#include "../unicode.h"
|
||||
#include <cctype>
|
||||
#include "../any.h"
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "../sequence.h"
|
||||
#include "../dir_nav.h"
|
||||
#include "../queue.h"
|
||||
#include "../smart_pointers.h"
|
||||
#include "../smart_pointers/scoped_ptr.h"
|
||||
#include "style.h"
|
||||
#include "../string.h"
|
||||
#include "../misc_api.h"
|
||||
|
@ -3,12 +3,12 @@
|
||||
#ifndef DLIB_JPEG_IMPORT
|
||||
#define DLIB_JPEG_IMPORT
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "jpeg_loader_abstract.h"
|
||||
#include "../smart_pointers.h"
|
||||
#include "image_loader.h"
|
||||
#include "../pixel.h"
|
||||
#include "../dir_nav.h"
|
||||
#include <vector>
|
||||
|
||||
namespace dlib
|
||||
{
|
||||
|
@ -4,7 +4,7 @@
|
||||
#define DLIB_PNG_IMPORT
|
||||
|
||||
#include "png_loader_abstract.h"
|
||||
#include "../smart_pointers.h"
|
||||
#include "../smart_pointers/scoped_ptr.h"
|
||||
#include "image_loader.h"
|
||||
#include "../pixel.h"
|
||||
#include "../dir_nav.h"
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "../assert.h"
|
||||
#include "../uintn.h"
|
||||
#include "../map.h"
|
||||
#include "../smart_pointers.h"
|
||||
#include "../smart_pointers/scoped_ptr.h"
|
||||
#include "../member_function_pointer.h"
|
||||
#include <streambuf>
|
||||
#include <vector>
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include "../matrix.h"
|
||||
#include "../smart_pointers.h"
|
||||
#include "../smart_pointers/scoped_ptr.h"
|
||||
#include "optimization_bobyqa_abstract.h"
|
||||
#include "optimization.h"
|
||||
|
||||
|
@ -151,6 +151,7 @@
|
||||
#include <deque>
|
||||
#include <complex>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <limits>
|
||||
#include "uintn.h"
|
||||
@ -160,7 +161,6 @@
|
||||
#include "unicode.h"
|
||||
#include "byte_orderer.h"
|
||||
#include "float_details.h"
|
||||
#include "smart_pointers/shared_ptr.h"
|
||||
|
||||
namespace dlib
|
||||
{
|
||||
@ -1490,7 +1490,7 @@ namespace dlib
|
||||
}
|
||||
|
||||
private:
|
||||
shared_ptr<std::ofstream> fout;
|
||||
std::shared_ptr<std::ofstream> fout;
|
||||
};
|
||||
|
||||
class proxy_deserialize
|
||||
@ -1513,7 +1513,7 @@ namespace dlib
|
||||
}
|
||||
|
||||
private:
|
||||
shared_ptr<std::ifstream> fin;
|
||||
std::shared_ptr<std::ifstream> fin;
|
||||
};
|
||||
|
||||
inline proxy_serialize serialize(const std::string& filename)
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "../algs.h"
|
||||
#include "../set.h"
|
||||
#include "../logger.h"
|
||||
#include "../smart_pointers.h"
|
||||
#include "../smart_pointers/scoped_ptr.h"
|
||||
|
||||
|
||||
namespace dlib
|
||||
|
@ -3,6 +3,16 @@
|
||||
#ifndef DLIB_SMART_POINTERs_H_
|
||||
#define DLIB_SMART_POINTERs_H_
|
||||
|
||||
// This is legacy smart pointer code that will likely to stop working under default
|
||||
// compiler flags when C++17 becomes the default standard in the compilers.
|
||||
// Please consider migrating your code to contemporary smart pointers from C++
|
||||
// standard library. The warning below will help to detect if the deprecated code
|
||||
// was included from library's clients.
|
||||
#if (defined(__GNUC__) && ((__GNUC__ >= 4 && __GNUC_MINOR__ >= 8) || (__GNUC__ > 4))) || \
|
||||
(defined(__clang__) && ((__clang_major__ >= 3 && __clang_minor__ >= 4)))
|
||||
#pragma GCC warning "smart_pointers.h is included which will fail to compile under C++17"
|
||||
#endif
|
||||
|
||||
#include "smart_pointers/scoped_ptr.h"
|
||||
#include "smart_pointers/shared_ptr.h"
|
||||
#include "smart_pointers/weak_ptr.h"
|
||||
|
@ -6,7 +6,7 @@
|
||||
#include <string>
|
||||
#include "../sockets.h"
|
||||
#include "sockets_extensions_abstract.h"
|
||||
#include "../smart_pointers.h"
|
||||
#include "../smart_pointers/scoped_ptr.h"
|
||||
#include <iosfwd>
|
||||
|
||||
namespace dlib
|
||||
|
@ -32,7 +32,7 @@
|
||||
|
||||
#include "../threads.h"
|
||||
#include "../algs.h"
|
||||
#include "../smart_pointers.h"
|
||||
#include "../smart_pointers/scoped_ptr.h"
|
||||
|
||||
|
||||
|
||||
|
@ -6,12 +6,14 @@
|
||||
#include "sqlite_abstract.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "../algs.h"
|
||||
#include <sqlite3.h>
|
||||
#include "../smart_pointers.h"
|
||||
#include "../serialize.h"
|
||||
#include <limits>
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
|
||||
@ -105,7 +107,7 @@ namespace dlib
|
||||
friend class statement;
|
||||
|
||||
std::string filename;
|
||||
shared_ptr<sqlite3> db;
|
||||
std::shared_ptr<sqlite3> db;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
@ -593,7 +595,7 @@ namespace dlib
|
||||
int step_status;
|
||||
bool at_first_step;
|
||||
|
||||
shared_ptr<sqlite3> db;
|
||||
std::shared_ptr<sqlite3> db;
|
||||
sqlite3_stmt* stmt;
|
||||
std::string sql_string;
|
||||
};
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "kcentroid.h"
|
||||
#include "kkmeans_abstract.h"
|
||||
#include "../noncopyable.h"
|
||||
#include "../smart_pointers.h"
|
||||
#include "../smart_pointers/scoped_ptr.h"
|
||||
#include <vector>
|
||||
|
||||
namespace dlib
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include "kernel.h"
|
||||
#include "kcentroid.h"
|
||||
#include <iostream>
|
||||
#include "../smart_pointers.h"
|
||||
#include <memory>
|
||||
|
||||
namespace dlib
|
||||
{
|
||||
@ -460,7 +460,7 @@ namespace dlib
|
||||
|
||||
const sample_vector_type* samples;
|
||||
|
||||
shared_ptr<cache_type> cache;
|
||||
std::shared_ptr<cache_type> cache;
|
||||
mutable unsigned long counter;
|
||||
unsigned long counter_threshold;
|
||||
long cache_size;
|
||||
|
@ -3,20 +3,19 @@
|
||||
#ifndef DLIB_STRUCTURAL_SVM_DISTRIBUTeD_Hh_
|
||||
#define DLIB_STRUCTURAL_SVM_DISTRIBUTeD_Hh_
|
||||
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
#include "structural_svm_distributed_abstract.h"
|
||||
#include "structural_svm_problem.h"
|
||||
#include "../bridge.h"
|
||||
#include "../smart_pointers.h"
|
||||
#include "../misc_api.h"
|
||||
#include "../statistics.h"
|
||||
|
||||
|
||||
#include "../threads.h"
|
||||
#include "../pipe.h"
|
||||
#include "../type_safe_union.h"
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
|
||||
namespace dlib
|
||||
{
|
||||
@ -678,9 +677,9 @@ namespace dlib
|
||||
typedef type_safe_union<impl::oracle_request<matrix_type> > tsu_out;
|
||||
typedef type_safe_union<impl::oracle_response<matrix_type>, long> tsu_in;
|
||||
|
||||
std::vector<shared_ptr<pipe<tsu_out> > > out_pipes;
|
||||
std::vector<std::shared_ptr<pipe<tsu_out> > > out_pipes;
|
||||
mutable pipe<tsu_in> in;
|
||||
std::vector<shared_ptr<bridge> > bridges;
|
||||
std::vector<std::shared_ptr<bridge> > bridges;
|
||||
long num_dims;
|
||||
};
|
||||
|
||||
|
@ -3,21 +3,21 @@
|
||||
#ifndef DLIB_SVm_THREADED_
|
||||
#define DLIB_SVm_THREADED_
|
||||
|
||||
#include "svm_threaded_abstract.h"
|
||||
#include "svm.h"
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
|
||||
#include "svm_threaded_abstract.h"
|
||||
#include "svm.h"
|
||||
#include "../matrix.h"
|
||||
#include "../algs.h"
|
||||
#include "../serialize.h"
|
||||
#include "function.h"
|
||||
#include "kernel.h"
|
||||
#include "../threads.h"
|
||||
#include <vector>
|
||||
#include "../smart_pointers.h"
|
||||
#include "../pipe.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace dlib
|
||||
{
|
||||
|
@ -125,7 +125,6 @@ set (tests
|
||||
set.cpp
|
||||
sldf.cpp
|
||||
sliding_buffer.cpp
|
||||
smart_pointers.cpp
|
||||
sockets2.cpp
|
||||
sockets.cpp
|
||||
sockstreambuf.cpp
|
||||
|
@ -1,6 +1,9 @@
|
||||
// Copyright (C) 2007 Davis E. King (davis@dlib.net)
|
||||
// License: Boost Software License See LICENSE.txt for the full license.
|
||||
|
||||
// This is a legacy test for old dlib smart pointers which is excluded
|
||||
// from CMakeLists.txt. Including this test will pull legacy smart_pointers.h
|
||||
// code which is uncompilable on C++17 compilers
|
||||
|
||||
#include <dlib/smart_pointers.h>
|
||||
#include <sstream>
|
||||
|
@ -10,7 +10,7 @@
|
||||
#include <dlib/misc_api.h>
|
||||
#include <dlib/sockstreambuf.h>
|
||||
#include <vector>
|
||||
#include <dlib/smart_pointers.h>
|
||||
#include <dlib/smart_pointers/scoped_ptr.h>
|
||||
|
||||
#include "tester.h"
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include "threads_kernel.h"
|
||||
#include "auto_mutex_extension.h"
|
||||
#include "threaded_object_extension.h"
|
||||
#include "../smart_pointers.h"
|
||||
#include "../smart_pointers/scoped_ptr.h"
|
||||
|
||||
namespace dlib
|
||||
{
|
||||
|
@ -4,6 +4,7 @@
|
||||
#define DLIB_THREAD_POOl_CPPh_
|
||||
|
||||
#include "thread_pool_extension.h"
|
||||
#include <memory>
|
||||
|
||||
namespace dlib
|
||||
{
|
||||
@ -287,7 +288,7 @@ namespace dlib
|
||||
uint64 thread_pool_implementation::
|
||||
add_task_internal (
|
||||
const bfp_type& bfp,
|
||||
shared_ptr<function_object_copy>& item
|
||||
std::shared_ptr<function_object_copy>& item
|
||||
)
|
||||
{
|
||||
auto_mutex M(m);
|
||||
|
@ -12,9 +12,9 @@
|
||||
#include "../uintn.h"
|
||||
#include "../array.h"
|
||||
#include "../smart_pointers_thread_safe.h"
|
||||
#include "../smart_pointers.h"
|
||||
#include <exception>
|
||||
#include <thread>
|
||||
#include <memory>
|
||||
|
||||
namespace dlib
|
||||
{
|
||||
@ -314,7 +314,7 @@ namespace dlib
|
||||
|
||||
uint64 add_task_internal (
|
||||
const bfp_type& bfp,
|
||||
shared_ptr<function_object_copy>& item
|
||||
std::shared_ptr<function_object_copy>& item
|
||||
);
|
||||
/*!
|
||||
ensures
|
||||
@ -326,7 +326,7 @@ namespace dlib
|
||||
|
||||
uint64 add_task_internal (
|
||||
const bfp_type& bfp
|
||||
) { shared_ptr<function_object_copy> temp; return add_task_internal(bfp, temp); }
|
||||
) { std::shared_ptr<function_object_copy> temp; return add_task_internal(bfp, temp); }
|
||||
/*!
|
||||
ensures
|
||||
- adds a task to call the given bfp object.
|
||||
@ -452,7 +452,7 @@ namespace dlib
|
||||
member_function_pointer<long,long> mfp2;
|
||||
bfp_type bfp;
|
||||
|
||||
shared_ptr<function_object_copy> function_copy;
|
||||
std::shared_ptr<function_object_copy> function_copy;
|
||||
mutable std::exception_ptr eptr; // non-null if the task threw an exception
|
||||
|
||||
void propagate_exception() const
|
||||
@ -596,7 +596,7 @@ namespace dlib
|
||||
{
|
||||
thread_pool_implementation::function_object_copy_instance<F>* ptr = 0;
|
||||
ptr = new thread_pool_implementation::function_object_copy_instance<F>(function_object);
|
||||
shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
std::shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
|
||||
|
||||
bfp_type temp;
|
||||
@ -627,7 +627,7 @@ namespace dlib
|
||||
{
|
||||
thread_pool_implementation::function_object_copy_instance<const T>* ptr = 0;
|
||||
ptr = new thread_pool_implementation::function_object_copy_instance<const T>(obj);
|
||||
shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
std::shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
|
||||
bfp_type temp;
|
||||
temp.set(ptr->item,funct);
|
||||
@ -644,7 +644,7 @@ namespace dlib
|
||||
{
|
||||
thread_pool_implementation::function_object_copy_instance<T>* ptr = 0;
|
||||
ptr = new thread_pool_implementation::function_object_copy_instance<T>(obj);
|
||||
shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
std::shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
|
||||
bfp_type temp;
|
||||
temp.set(ptr->item,funct);
|
||||
@ -693,7 +693,7 @@ namespace dlib
|
||||
{
|
||||
thread_pool_implementation::function_object_copy_instance<F>* ptr = 0;
|
||||
ptr = new thread_pool_implementation::function_object_copy_instance<F>(function_object);
|
||||
shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
std::shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
|
||||
bfp_type temp;
|
||||
temp.set(ptr->item, arg1.get());
|
||||
@ -731,7 +731,7 @@ namespace dlib
|
||||
{
|
||||
thread_pool_implementation::function_object_copy_instance<T>* ptr = 0;
|
||||
ptr = new thread_pool_implementation::function_object_copy_instance<T>(obj);
|
||||
shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
std::shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
|
||||
bfp_type temp;
|
||||
temp.set(ptr->item,funct,arg1.get());
|
||||
@ -770,7 +770,7 @@ namespace dlib
|
||||
{
|
||||
thread_pool_implementation::function_object_copy_instance<const T>* ptr = 0;
|
||||
ptr = new thread_pool_implementation::function_object_copy_instance<const T>(obj);
|
||||
shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
std::shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
|
||||
bfp_type temp;
|
||||
temp.set(ptr->item,funct,arg1.get());
|
||||
@ -831,7 +831,7 @@ namespace dlib
|
||||
{
|
||||
thread_pool_implementation::function_object_copy_instance<F>* ptr = 0;
|
||||
ptr = new thread_pool_implementation::function_object_copy_instance<F>(function_object);
|
||||
shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
std::shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
|
||||
bfp_type temp;
|
||||
temp.set(ptr->item, arg1.get(), arg2.get());
|
||||
@ -877,7 +877,7 @@ namespace dlib
|
||||
{
|
||||
thread_pool_implementation::function_object_copy_instance<T>* ptr = 0;
|
||||
ptr = new thread_pool_implementation::function_object_copy_instance<T>(obj);
|
||||
shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
std::shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
|
||||
bfp_type temp;
|
||||
temp.set(ptr->item, funct, arg1.get(), arg2.get());
|
||||
@ -923,7 +923,7 @@ namespace dlib
|
||||
{
|
||||
thread_pool_implementation::function_object_copy_instance<const T>* ptr = 0;
|
||||
ptr = new thread_pool_implementation::function_object_copy_instance<const T>(obj);
|
||||
shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
std::shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
|
||||
bfp_type temp;
|
||||
temp.set(ptr->item, funct, arg1.get(), arg2.get());
|
||||
@ -994,7 +994,7 @@ namespace dlib
|
||||
{
|
||||
thread_pool_implementation::function_object_copy_instance<F>* ptr = 0;
|
||||
ptr = new thread_pool_implementation::function_object_copy_instance<F>(function_object);
|
||||
shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
std::shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
|
||||
bfp_type temp;
|
||||
temp.set(ptr->item, arg1.get(), arg2.get(), arg3.get());
|
||||
@ -1048,7 +1048,7 @@ namespace dlib
|
||||
{
|
||||
thread_pool_implementation::function_object_copy_instance<T>* ptr = 0;
|
||||
ptr = new thread_pool_implementation::function_object_copy_instance<T>(obj);
|
||||
shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
std::shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
|
||||
bfp_type temp;
|
||||
temp.set(ptr->item, funct, arg1.get(), arg2.get(), arg3.get());
|
||||
@ -1102,7 +1102,7 @@ namespace dlib
|
||||
{
|
||||
thread_pool_implementation::function_object_copy_instance<const T>* ptr = 0;
|
||||
ptr = new thread_pool_implementation::function_object_copy_instance<const T>(obj);
|
||||
shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
std::shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
|
||||
bfp_type temp;
|
||||
temp.set(ptr->item, funct, arg1.get(), arg2.get(), arg3.get());
|
||||
@ -1183,7 +1183,7 @@ namespace dlib
|
||||
{
|
||||
thread_pool_implementation::function_object_copy_instance<F>* ptr = 0;
|
||||
ptr = new thread_pool_implementation::function_object_copy_instance<F>(function_object);
|
||||
shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
std::shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
|
||||
bfp_type temp;
|
||||
temp.set(ptr->item, arg1.get(), arg2.get(), arg3.get(), arg4.get());
|
||||
@ -1245,7 +1245,7 @@ namespace dlib
|
||||
{
|
||||
thread_pool_implementation::function_object_copy_instance<T>* ptr = 0;
|
||||
ptr = new thread_pool_implementation::function_object_copy_instance<T>(obj);
|
||||
shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
std::shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
|
||||
bfp_type temp;
|
||||
temp.set(ptr->item, funct, arg1.get(), arg2.get(), arg3.get(), arg4.get());
|
||||
@ -1307,7 +1307,7 @@ namespace dlib
|
||||
{
|
||||
thread_pool_implementation::function_object_copy_instance<const T>* ptr = 0;
|
||||
ptr = new thread_pool_implementation::function_object_copy_instance<const T>(obj);
|
||||
shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
std::shared_ptr<thread_pool_implementation::function_object_copy> function_copy(ptr);
|
||||
|
||||
bfp_type temp;
|
||||
temp.set(ptr->item, funct, arg1.get(), arg2.get(), arg3.get(), arg4.get());
|
||||
|
@ -27,7 +27,7 @@
|
||||
#include <dlib/directed_graph.h>
|
||||
#include <dlib/string.h>
|
||||
#include <dlib/bayes_utils.h>
|
||||
#include <dlib/smart_pointers.h>
|
||||
#include <dlib/smart_pointers/scoped_ptr.h>
|
||||
#include <dlib/set.h>
|
||||
#include <dlib/graph_utils.h>
|
||||
#include <dlib/stl_checked.h>
|
||||
|
Loading…
Reference in New Issue
Block a user