Replacing the use of <iomanip> with <boost/detail/iomanip.hpp> across Boost.

On Linux, GNU's libstdc++, which is the default stdlib for icc and clang,
cannot parse the <iomanip> header in version 4.5+ (which thankfully neither
compiler advises the use of yet), as it's original C++98-friendly
implementation has been replaced with a gnu++0x implementation.
<boost/detail/iomanip.hpp> is a portable implementation of <iomanip>, providing
boost::detail::setfill, boost::detail::setbase, boost::detail::setw,
boost::detail::setprecision, boost::detail::setiosflags and
boost::detail::resetiosflags. 



[SVN r68140]
This commit is contained in:
Bryce Adelstein-Lelbach 2011-01-14 02:35:58 +00:00
parent ec5f6a655c
commit 074277924a
12 changed files with 39 additions and 38 deletions

View File

@ -9,7 +9,7 @@
#include <vector> #include <vector>
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <iomanip> #include <boost/detail/iomanip.hpp>
#include <boost/graph/adjacency_list.hpp> #include <boost/graph/adjacency_list.hpp>
#include <boost/graph/bellman_ford_shortest_paths.hpp> #include <boost/graph/bellman_ford_shortest_paths.hpp>
@ -95,7 +95,7 @@ main()
if (r) if (r)
for (i = 0; i < N; ++i) for (i = 0; i < N; ++i)
std::cout << name[i] << ": " << std::setw(3) << distance[i] std::cout << name[i] << ": " << boost::detail::setw(3) << distance[i]
<< " " << name[parent[i]] << std::endl; << " " << name[parent[i]] << std::endl;
else else
std::cout << "negative cycle" << std::endl; std::cout << "negative cycle" << std::endl;

View File

@ -6,7 +6,7 @@
//[closeness_centrality_example //[closeness_centrality_example
#include <iostream> #include <iostream>
#include <iomanip> #include <boost/detail/iomanip.hpp>
#include <boost/graph/undirected_graph.hpp> #include <boost/graph/undirected_graph.hpp>
#include <boost/graph/exterior_property.hpp> #include <boost/graph/exterior_property.hpp>
@ -76,7 +76,7 @@ main(int argc, char *argv[])
// Print the closeness centrality of each vertex. // Print the closeness centrality of each vertex.
graph_traits<Graph>::vertex_iterator i, end; graph_traits<Graph>::vertex_iterator i, end;
for(tie(i, end) = vertices(g); i != end; ++i) { for(tie(i, end) = vertices(g); i != end; ++i) {
cout << setw(12) << setiosflags(ios::left) cout << boost::detail::setw(12) << boost::detail::setiosflags(ios::left)
<< g[*i].name << get(cm, *i) << endl; << g[*i].name << get(cm, *i) << endl;
} }

View File

@ -7,7 +7,7 @@
//[code_clustering_coefficient //[code_clustering_coefficient
#include <iostream> #include <iostream>
#include <iomanip> #include <boost/detail/iomanip.hpp>
#include <boost/graph/undirected_graph.hpp> #include <boost/graph/undirected_graph.hpp>
#include <boost/graph/exterior_property.hpp> #include <boost/graph/exterior_property.hpp>
@ -59,7 +59,7 @@ main(int argc, char *argv[])
// Print the clustering coefficient of each vertex. // Print the clustering coefficient of each vertex.
graph_traits<Graph>::vertex_iterator i, end; graph_traits<Graph>::vertex_iterator i, end;
for(tie(i, end) = vertices(g); i != end; ++i) { for(tie(i, end) = vertices(g); i != end; ++i) {
cout << setw(12) << setiosflags(ios::left) cout << boost::detail::setw(12) << boost::detail::setiosflags(ios::left)
<< g[*i].name << get(cm, *i) << endl; << g[*i].name << get(cm, *i) << endl;
} }
cout << "mean clustering coefficient: " << cc << endl; cout << "mean clustering coefficient: " << cc << endl;

View File

@ -7,7 +7,7 @@
//[degree_centrality_example //[degree_centrality_example
#include <iostream> #include <iostream>
#include <iomanip> #include <boost/detail/iomanip.hpp>
#include <boost/graph/undirected_graph.hpp> #include <boost/graph/undirected_graph.hpp>
#include <boost/graph/exterior_property.hpp> #include <boost/graph/exterior_property.hpp>
@ -58,7 +58,7 @@ main(int argc, char *argv[])
// Print the degree centrality of each vertex. // Print the degree centrality of each vertex.
graph_traits<Graph>::vertex_iterator i, end; graph_traits<Graph>::vertex_iterator i, end;
for(tie(i, end) = vertices(g); i != end; ++i) { for(tie(i, end) = vertices(g); i != end; ++i) {
cout << setiosflags(ios::left) << setw(12) cout << boost::detail::setiosflags(ios::left) << boost::detail::setw(12)
<< g[*i].name << cm[*i] << endl; << g[*i].name << cm[*i] << endl;
} }

View File

@ -7,7 +7,7 @@
//[eccentricity_example //[eccentricity_example
#include <iostream> #include <iostream>
#include <iomanip> #include <boost/detail/iomanip.hpp>
#include <boost/graph/undirected_graph.hpp> #include <boost/graph/undirected_graph.hpp>
#include <boost/graph/exterior_property.hpp> #include <boost/graph/exterior_property.hpp>
@ -78,7 +78,7 @@ main(int argc, char *argv[])
// Print the closeness centrality of each vertex. // Print the closeness centrality of each vertex.
graph_traits<Graph>::vertex_iterator i, end; graph_traits<Graph>::vertex_iterator i, end;
for(boost::tie(i, end) = vertices(g); i != end; ++i) { for(boost::tie(i, end) = vertices(g); i != end; ++i) {
cout << setw(12) << setiosflags(ios::left) cout << boost::detail::setw(12) << boost::detail::setiosflags(ios::left)
<< g[*i].name << get(em, *i) << endl; << g[*i].name << get(em, *i) << endl;
} }
cout << "radius: " << r << endl; cout << "radius: " << r << endl;

View File

@ -6,7 +6,7 @@
//[inclusive_mean_geodesic_example //[inclusive_mean_geodesic_example
#include <iostream> #include <iostream>
#include <iomanip> #include <boost/detail/iomanip.hpp>
#include <boost/graph/directed_graph.hpp> #include <boost/graph/directed_graph.hpp>
#include <boost/graph/exterior_property.hpp> #include <boost/graph/exterior_property.hpp>
@ -117,15 +117,15 @@ main(int argc, char *argv[])
// Print the mean geodesic distance of each vertex and finally, // Print the mean geodesic distance of each vertex and finally,
// the graph itself. // the graph itself.
cout << setw(12) << setiosflags(ios::left) << "vertex"; cout << boost::detail::setw(12) << boost::detail::setiosflags(ios::left) << "vertex";
cout << setw(12) << setiosflags(ios::left) << "excluding"; cout << boost::detail::setw(12) << boost::detail::setiosflags(ios::left) << "excluding";
cout << setw(12) << setiosflags(ios::left) << "including" << endl; cout << boost::detail::setw(12) << boost::detail::setiosflags(ios::left) << "including" << endl;
graph_traits<Graph>::vertex_iterator i, end; graph_traits<Graph>::vertex_iterator i, end;
for(tie(i, end) = vertices(g); i != end; ++i) { for(tie(i, end) = vertices(g); i != end; ++i) {
cout << setw(12) << setiosflags(ios::left) cout << boost::detail::setw(12) << boost::detail::setiosflags(ios::left)
<< g[*i].name << g[*i].name
<< setw(12) << get(exmap, *i) << boost::detail::setw(12) << get(exmap, *i)
<< setw(12) << get(inmap, *i) << endl; << boost::detail::setw(12) << get(inmap, *i) << endl;
} }
cout << "small world (excluding self-loops): " << ex << endl; cout << "small world (excluding self-loops): " << ex << endl;
cout << "small world (including self-loops): " << in << endl; cout << "small world (including self-loops): " << in << endl;

View File

@ -6,7 +6,7 @@
//[influence_prestige_example //[influence_prestige_example
#include <iostream> #include <iostream>
#include <iomanip> #include <boost/detail/iomanip.hpp>
#include <boost/graph/directed_graph.hpp> #include <boost/graph/directed_graph.hpp>
#include <boost/graph/exterior_property.hpp> #include <boost/graph/exterior_property.hpp>
@ -64,7 +64,8 @@ main(int argc, char *argv[])
graph_traits<Graph>::vertex_iterator i, end; graph_traits<Graph>::vertex_iterator i, end;
for(tie(i, end) = vertices(g); i != end; ++i) { for(tie(i, end) = vertices(g); i != end; ++i) {
Vertex v = *i; Vertex v = *i;
cout << setiosflags(ios::left) << setw(12) cout << ::boost::detail::setiosflags(ios::left)
<< ::boost::detail::setw(12)
<< g[v].name << "\t" << g[v].name << "\t"
<< im[v] << "\t" << im[v] << "\t"
<< pm[v] << endl; << pm[v] << endl;

View File

@ -9,7 +9,7 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <iomanip> #include <boost/detail/iomanip.hpp>
#include <boost/property_map/property_map.hpp> #include <boost/property_map/property_map.hpp>
#include <boost/graph/adjacency_list.hpp> #include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graphviz.hpp> #include <boost/graph/graphviz.hpp>
@ -52,15 +52,15 @@ main()
std::cout << " "; std::cout << " ";
for (int k = 0; k < V; ++k) for (int k = 0; k < V; ++k)
std::cout << std::setw(5) << k; std::cout << boost::detail::setw(5) << k;
std::cout << std::endl; std::cout << std::endl;
for (int i = 0; i < V; ++i) { for (int i = 0; i < V; ++i) {
std::cout << std::setw(3) << i << " -> "; std::cout << boost::detail::setw(3) << i << " -> ";
for (int j = 0; j < V; ++j) { for (int j = 0; j < V; ++j) {
if (D[i][j] == (std::numeric_limits<int>::max)()) if (D[i][j] == (std::numeric_limits<int>::max)())
std::cout << std::setw(5) << "inf"; std::cout << boost::detail::setw(5) << "inf";
else else
std::cout << std::setw(5) << D[i][j]; std::cout << boost::detail::setw(5) << D[i][j];
} }
std::cout << std::endl; std::cout << std::endl;
} }

View File

@ -6,7 +6,7 @@
//[mean_geodesic_example //[mean_geodesic_example
#include <iostream> #include <iostream>
#include <iomanip> #include <boost/detail/iomanip.hpp>
#include <boost/graph/undirected_graph.hpp> #include <boost/graph/undirected_graph.hpp>
#include <boost/graph/exterior_property.hpp> #include <boost/graph/exterior_property.hpp>
@ -78,7 +78,7 @@ main(int argc, char *argv[])
// the graph itself. // the graph itself.
graph_traits<Graph>::vertex_iterator i, end; graph_traits<Graph>::vertex_iterator i, end;
for(tie(i, end) = vertices(g); i != end; ++i) { for(tie(i, end) = vertices(g); i != end; ++i) {
cout << setw(12) << setiosflags(ios::left) cout << boost::detail::setw(12) << boost::detail::setiosflags(ios::left)
<< g[*i].name << get(gm, *i) << endl; << g[*i].name << get(gm, *i) << endl;
} }
cout << "small world distance: " << sw << endl; cout << "small world distance: " << sw << endl;

View File

@ -6,7 +6,7 @@
//[scaled_closeness_centrality_example //[scaled_closeness_centrality_example
#include <iostream> #include <iostream>
#include <iomanip> #include <boost/detail/iomanip.hpp>
#include <boost/graph/undirected_graph.hpp> #include <boost/graph/undirected_graph.hpp>
#include <boost/graph/exterior_property.hpp> #include <boost/graph/exterior_property.hpp>
@ -105,7 +105,7 @@ main(int argc, char *argv[])
// Print the scaled closeness centrality of each vertex. // Print the scaled closeness centrality of each vertex.
graph_traits<Graph>::vertex_iterator i, end; graph_traits<Graph>::vertex_iterator i, end;
for(tie(i, end) = vertices(g); i != end; ++i) { for(tie(i, end) = vertices(g); i != end; ++i) {
cout << setw(12) << setiosflags(ios::left) cout << boost::detail::setw(12) << boost::detail::setiosflags(ios::left)
<< g[*i].name << get(cm, *i) << endl; << g[*i].name << get(cm, *i) << endl;
} }

View File

@ -14,7 +14,7 @@ B: 2147483647 B
*/ */
#include <iostream> #include <iostream>
#include <iomanip> #include <boost/detail/iomanip.hpp>
#include <boost/graph/adjacency_list.hpp> #include <boost/graph/adjacency_list.hpp>
#include <boost/graph/bellman_ford_shortest_paths.hpp> #include <boost/graph/bellman_ford_shortest_paths.hpp>
#include <boost/cstdlib.hpp> #include <boost/cstdlib.hpp>
@ -66,9 +66,9 @@ int test_main(int, char*[])
for(int i = 0; i < numVertex; ++i) { for(int i = 0; i < numVertex; ++i) {
std::cout << name[i] << ": "; std::cout << name[i] << ": ";
if (distance[i] == inf) if (distance[i] == inf)
std::cout << std::setw(3) << "inf"; std::cout << boost::detail::setw(3) << "inf";
else else
std::cout << std::setw(3) << distance[i]; std::cout << boost::detail::setw(3) << distance[i];
std::cout << " " << name[parent[i]] << std::endl; std::cout << " " << name[parent[i]] << std::endl;
} }
} else { } else {
@ -87,9 +87,9 @@ int test_main(int, char*[])
for(int i = 0; i < numVertex; ++i) { for(int i = 0; i < numVertex; ++i) {
std::cout << name[i] << ": "; std::cout << name[i] << ": ";
if (distance2[i] == inf) if (distance2[i] == inf)
std::cout << std::setw(3) << "inf"; std::cout << boost::detail::setw(3) << "inf";
else else
std::cout << std::setw(3) << distance2[i]; std::cout << boost::detail::setw(3) << distance2[i];
std::cout << " " << name[parent2[i]] << std::endl; std::cout << " " << name[parent2[i]] << std::endl;
} }
} else { } else {

View File

@ -26,7 +26,7 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <iomanip> #include <boost/detail/iomanip.hpp>
#include <boost/property_map/property_map.hpp> #include <boost/property_map/property_map.hpp>
#include <boost/graph/adjacency_list.hpp> #include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graphviz.hpp> #include <boost/graph/graphviz.hpp>
@ -63,14 +63,14 @@ int main()
int D[V][V]; int D[V][V];
johnson_all_pairs_shortest_paths(g, D, distance_map(&d[0])); johnson_all_pairs_shortest_paths(g, D, distance_map(&d[0]));
std::cout << std::setw(5) <<" "; std::cout << boost::detail::setw(5) <<" ";
for (int k = 0; k < 10; ++k) for (int k = 0; k < 10; ++k)
std::cout << std::setw(5) << k ; std::cout << boost::detail::setw(5) << k ;
std::cout << std::endl; std::cout << std::endl;
for (int i = 0; i < 10; ++i) { for (int i = 0; i < 10; ++i) {
std::cout <<std::setw(5) << i ; std::cout <<boost::detail::setw(5) << i ;
for (int j = 0; j < 10; ++j) { for (int j = 0; j < 10; ++j) {
std::cout << std::setw(5) << D[i][j] ; std::cout << boost::detail::setw(5) << D[i][j] ;
} }
std::cout << std::endl; std::cout << std::endl;
} }