Commit 9e7e39a5 authored by Davis King's avatar Davis King

Renamed the array::expand() function to array::resize().

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402818
parent 54235960
...@@ -17,7 +17,7 @@ namespace dlib ...@@ -17,7 +17,7 @@ namespace dlib
public: public:
void expand ( void resize (
unsigned long new_size unsigned long new_size
); );
...@@ -61,7 +61,7 @@ namespace dlib ...@@ -61,7 +61,7 @@ namespace dlib
typename array_base typename array_base
> >
void array_expand_1<array_base>:: void array_expand_1<array_base>::
expand ( resize (
unsigned long new_size unsigned long new_size
) )
{ {
......
...@@ -19,7 +19,7 @@ namespace dlib ...@@ -19,7 +19,7 @@ namespace dlib
must be an implementation of array/array_kernel_abstract.h must be an implementation of array/array_kernel_abstract.h
POINTERS AND REFERENCES POINTERS AND REFERENCES
expand() may invalidate pointers and references to internal data. resize() may invalidate pointers and references to internal data.
WHAT THIS EXTENSION DOES FOR ARRAY WHAT THIS EXTENSION DOES FOR ARRAY
This extension gives an array the ability to expand its size() beyond This extension gives an array the ability to expand its size() beyond
...@@ -30,7 +30,7 @@ namespace dlib ...@@ -30,7 +30,7 @@ namespace dlib
typedef typename array_base::type T; typedef typename array_base::type T;
public: public:
void expand ( void resize (
unsigned long new_size unsigned long new_size
); );
/*! /*!
......
...@@ -1225,7 +1225,7 @@ namespace dlib ...@@ -1225,7 +1225,7 @@ namespace dlib
{ {
create_bayesian_network_join_tree(bn, join_tree, join_tree_values); create_bayesian_network_join_tree(bn, join_tree, join_tree_values);
cliques.expand(bn.number_of_nodes()); cliques.resize(bn.number_of_nodes());
// figure out which cliques contain each node // figure out which cliques contain each node
for (unsigned long i = 0; i < cliques.size(); ++i) for (unsigned long i = 0; i < cliques.size(); ++i)
...@@ -1496,8 +1496,8 @@ namespace dlib ...@@ -1496,8 +1496,8 @@ namespace dlib
// we are done // we are done
dlib::array<dlib::set<unsigned long>::compare_1b_c>::expand_1a_c remaining_msg_to_send; dlib::array<dlib::set<unsigned long>::compare_1b_c>::expand_1a_c remaining_msg_to_send;
dlib::array<dlib::set<unsigned long>::compare_1b_c>::expand_1a_c remaining_msg_to_receive; dlib::array<dlib::set<unsigned long>::compare_1b_c>::expand_1a_c remaining_msg_to_receive;
remaining_msg_to_receive.expand(join_tree.number_of_nodes()); remaining_msg_to_receive.resize(join_tree.number_of_nodes());
remaining_msg_to_send.expand(join_tree.number_of_nodes()); remaining_msg_to_send.resize(join_tree.number_of_nodes());
for (unsigned long i = 0; i < remaining_msg_to_receive.size(); ++i) for (unsigned long i = 0; i < remaining_msg_to_receive.size(); ++i)
{ {
for (unsigned long j = 0; j < join_tree.node(i).number_of_neighbors(); ++j) for (unsigned long j = 0; j < join_tree.node(i).number_of_neighbors(); ++j)
......
...@@ -444,7 +444,7 @@ namespace dlib ...@@ -444,7 +444,7 @@ namespace dlib
specified_default_char( default_char_ ) specified_default_char( default_char_ )
{ {
// make sure gl contains at least one letter // make sure gl contains at least one letter
gl.expand(1); gl.resize(1);
} }
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
...@@ -503,7 +503,7 @@ namespace dlib ...@@ -503,7 +503,7 @@ namespace dlib
bdf_parser::header_info hinfo; bdf_parser::header_info hinfo;
bdf_parser::char_info cinfo; bdf_parser::char_info cinfo;
gl.expand(max_enc+1); gl.resize(max_enc+1);
hinfo.default_char = - 1; hinfo.default_char = - 1;
if ( is_initialized == false || static_cast<std::streamoff>(in.tellg()) == std::ios::beg ) if ( is_initialized == false || static_cast<std::streamoff>(in.tellg()) == std::ios::beg )
{ {
......
...@@ -173,7 +173,7 @@ namespace dlib ...@@ -173,7 +173,7 @@ namespace dlib
{ {
unsigned long num; unsigned long num;
deserialize(num, in); deserialize(num, in);
item.centers.expand(num); item.centers.resize(num);
for (unsigned long i = 0; i < item.centers.size(); ++i) for (unsigned long i = 0; i < item.centers.size(); ++i)
{ {
scoped_ptr<kcentroid<kernel_type> > temp(new kcentroid<kernel_type>(kernel_type())); scoped_ptr<kcentroid<kernel_type> > temp(new kcentroid<kernel_type>(kernel_type()));
...@@ -215,7 +215,7 @@ namespace dlib ...@@ -215,7 +215,7 @@ namespace dlib
centers[i]->train(initial_centers(i)); centers[i]->train(initial_centers(i));
} }
assignments.expand(samples.size()); assignments.resize(samples.size());
bool assignment_changed = true; bool assignment_changed = true;
......
...@@ -491,7 +491,7 @@ namespace ...@@ -491,7 +491,7 @@ namespace
DLIB_CASSERT(a1.size() == 0,""); DLIB_CASSERT(a1.size() == 0,"");
DLIB_CASSERT(a1.max_size() == 0,""); DLIB_CASSERT(a1.max_size() == 0,"");
a1.expand(10); a1.resize(10);
DLIB_CASSERT(a1.size() == 10,""); DLIB_CASSERT(a1.size() == 10,"");
DLIB_CASSERT(a1.max_size() == 10,""); DLIB_CASSERT(a1.max_size() == 10,"");
...@@ -501,7 +501,7 @@ namespace ...@@ -501,7 +501,7 @@ namespace
} }
print_spinner(); print_spinner();
a1.expand(100); a1.resize(100);
DLIB_CASSERT(a1.size() == 100,""); DLIB_CASSERT(a1.size() == 100,"");
DLIB_CASSERT(a1.max_size() == 100,""); DLIB_CASSERT(a1.max_size() == 100,"");
...@@ -510,7 +510,7 @@ namespace ...@@ -510,7 +510,7 @@ namespace
DLIB_CASSERT(a1[i] == i,""); DLIB_CASSERT(a1[i] == i,"");
} }
a1.expand(50); a1.resize(50);
DLIB_CASSERT(a1.size() == 50,""); DLIB_CASSERT(a1.size() == 50,"");
DLIB_CASSERT(a1.max_size() == 100,""); DLIB_CASSERT(a1.max_size() == 100,"");
...@@ -519,7 +519,7 @@ namespace ...@@ -519,7 +519,7 @@ namespace
DLIB_CASSERT(a1[i] == i,""); DLIB_CASSERT(a1[i] == i,"");
} }
a1.expand(10); a1.resize(10);
DLIB_CASSERT(a1.size() == 10,""); DLIB_CASSERT(a1.size() == 10,"");
DLIB_CASSERT(a1.max_size() == 100,""); DLIB_CASSERT(a1.max_size() == 100,"");
...@@ -528,7 +528,7 @@ namespace ...@@ -528,7 +528,7 @@ namespace
DLIB_CASSERT(a1[i] == i,""); DLIB_CASSERT(a1[i] == i,"");
} }
a1.expand(20); a1.resize(20);
DLIB_CASSERT(a1.size() == 20,""); DLIB_CASSERT(a1.size() == 20,"");
DLIB_CASSERT(a1.max_size() == 100,""); DLIB_CASSERT(a1.max_size() == 100,"");
...@@ -538,7 +538,7 @@ namespace ...@@ -538,7 +538,7 @@ namespace
} }
a1.expand(100); a1.resize(100);
DLIB_CASSERT(a1.size() == 100,""); DLIB_CASSERT(a1.size() == 100,"");
DLIB_CASSERT(a1.max_size() == 100,""); DLIB_CASSERT(a1.max_size() == 100,"");
......
...@@ -165,7 +165,7 @@ namespace ...@@ -165,7 +165,7 @@ namespace
std::vector<double> stdv(4); std::vector<double> stdv(4);
std_vector_c<double> stdv_c(4); std_vector_c<double> stdv_c(4);
dlib::array<double>::expand_1a_c arr; dlib::array<double>::expand_1a_c arr;
arr.expand(4); arr.resize(4);
for (long i = 0; i < 4; ++i) for (long i = 0; i < 4; ++i)
stdv[i] = stdv_c[i] = arr[i] = i+1; stdv[i] = stdv_c[i] = arr[i] = i+1;
......
...@@ -18,7 +18,7 @@ namespace dlib ...@@ -18,7 +18,7 @@ namespace dlib
task_ready_signaler(m), task_ready_signaler(m),
we_are_destructing(false) we_are_destructing(false)
{ {
tasks.expand(num_threads); tasks.resize(num_threads);
for (unsigned long i = 0; i < num_threads; ++i) for (unsigned long i = 0; i < num_threads; ++i)
{ {
register_thread(*this, &thread_pool::thread); register_thread(*this, &thread_pool::thread);
......
...@@ -792,8 +792,8 @@ namespace dlib ...@@ -792,8 +792,8 @@ namespace dlib
}; };
array<task_state_type>::expand_1c_c tasks; array<task_state_type>::expand_1d_c tasks;
array<thread_id_type>::expand_1c_c worker_thread_ids; array<thread_id_type>::expand_1d_c worker_thread_ids;
mutex m; mutex m;
signaler task_done_signaler; signaler task_done_signaler;
......
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