Commit a4d4d4ef authored by Davis King's avatar Davis King

Changed a few things to avoid warnings in visual studio

--HG--
extra : convert_revision : svn%3Afdd8eb12-d10e-0410-9acb-85c331704f74/trunk%402645
parent e236f0ea
......@@ -30,6 +30,11 @@
// of the form () will be default-initialized.
// I love it when this compiler gives warnings about bugs in previous versions of itself.
#pragma warning(disable : 4345)
// Disable warnings about conversion from size_t to unsigned long and long.
#pragma warning(disable : 4267)
#endif
#ifdef __BORLANDC__
......
......@@ -605,16 +605,16 @@ namespace dlib
node_type& c = *nodes[child_node_index];
// remove the record of the link from the parent node
unsigned long pos = find( p.children.begin(),
unsigned long pos = static_cast<unsigned long>(find( p.children.begin(),
p.children.end(),
&c) - p.children.begin();
&c) - p.children.begin());
p.children.erase(p.children.begin()+pos);
p.edge_children.erase(p.edge_children.begin()+pos);
// remove the record of the link from the child node
pos = find( c.parents.begin(),
pos = static_cast<unsigned long>(find( c.parents.begin(),
c.parents.end(),
&p) - c.parents.begin();
&p) - c.parents.begin());
c.parents.erase(c.parents.begin() + pos);
c.edge_parents.erase(c.edge_parents.begin() + pos);
}
......@@ -666,9 +666,9 @@ namespace dlib
for (unsigned long i = 0; i < n.parents.size(); ++i)
{
// remove the edge from this specific parent
unsigned long pos = find(n.parents[i]->children.begin(),
unsigned long pos = static_cast<unsigned long>(find(n.parents[i]->children.begin(),
n.parents[i]->children.end(),
&n) - n.parents[i]->children.begin();
&n) - n.parents[i]->children.begin());
n.parents[i]->children.erase(n.parents[i]->children.begin() + pos);
n.parents[i]->edge_children.erase(n.parents[i]->edge_children.begin() + pos);
......@@ -678,9 +678,9 @@ namespace dlib
for (unsigned long i = 0; i < n.children.size(); ++i)
{
// remove the edge from this specific child
unsigned long pos = find(n.children[i]->parents.begin(),
unsigned long pos = static_cast<unsigned long>(find(n.children[i]->parents.begin(),
n.children[i]->parents.end(),
&n) - n.children[i]->parents.begin();
&n) - n.children[i]->parents.begin());
n.children[i]->parents.erase(n.children[i]->parents.begin() + pos);
n.children[i]->edge_parents.erase(n.children[i]->edge_parents.begin() + pos);
......
......@@ -544,7 +544,7 @@ namespace dlib
node_type& n2 = *nodes[node_index2];
// remove the record of the link from n1
unsigned long pos = find(n1.neighbors.begin(), n1.neighbors.end(), &n2) - n1.neighbors.begin();
unsigned long pos = static_cast<unsigned long>(find(n1.neighbors.begin(), n1.neighbors.end(), &n2) - n1.neighbors.begin());
n1.neighbors.erase(n1.neighbors.begin() + pos);
n1.edges.erase(n1.edges.begin() + pos);
......@@ -552,7 +552,7 @@ namespace dlib
if (node_index1 != node_index2)
{
// remove the record of the link from n2
unsigned long pos = find(n2.neighbors.begin(), n2.neighbors.end(), &n1) - n2.neighbors.begin();
unsigned long pos = static_cast<unsigned long>(find(n2.neighbors.begin(), n2.neighbors.end(), &n1) - n2.neighbors.begin());
n2.neighbors.erase(n2.neighbors.begin() + pos);
n2.edges.erase(n2.edges.begin() + pos);
}
......@@ -605,8 +605,8 @@ namespace dlib
for (unsigned long i = 0; i < n.neighbors.size(); ++i)
{
// remove the edge from this specific parent
unsigned long pos = find(n.neighbors[i]->neighbors.begin(), n.neighbors[i]->neighbors.end(), &n) -
n.neighbors[i]->neighbors.begin();
unsigned long pos = static_cast<unsigned long>(find(n.neighbors[i]->neighbors.begin(), n.neighbors[i]->neighbors.end(), &n) -
n.neighbors[i]->neighbors.begin());
n.neighbors[i]->neighbors.erase(n.neighbors[i]->neighbors.begin() + pos);
n.neighbors[i]->edges.erase(n.neighbors[i]->edges.begin() + pos);
}
......
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