Skip to content

Commit 34e042a

Browse files
committed
Reduce Boost header includes
1 parent cc65c5b commit 34e042a

File tree

8 files changed

+45
-22
lines changed

8 files changed

+45
-22
lines changed

include/boost/compute/detail/get_object_info.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
#include <string>
1515
#include <vector>
1616

17+
#include <boost/preprocessor/seq/for_each.hpp>
18+
#include <boost/preprocessor/tuple/elem.hpp>
19+
1720
#include <boost/throw_exception.hpp>
1821

1922
#include <boost/compute/cl.hpp>

include/boost/compute/detail/parameter_cache.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include <boost/compute/version.hpp>
2525

2626
#ifdef BOOST_COMPUTE_USE_OFFLINE_CACHE
27-
#include <boost/algorithm/string.hpp>
27+
#include <boost/algorithm/string/trim.hpp>
2828
#include <boost/compute/detail/path.hpp>
2929
#include <boost/property_tree/ptree.hpp>
3030
#include <boost/property_tree/json_parser.hpp>

include/boost/compute/detail/path.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
#ifndef BOOST_COMPUTE_DETAIL_PATH_HPP
1212
#define BOOST_COMPUTE_DETAIL_PATH_HPP
1313

14-
#include <boost/filesystem.hpp>
14+
#include <boost/filesystem/path.hpp>
15+
#include <boost/filesystem/operations.hpp>
1516
#include <boost/compute/detail/getenv.hpp>
1617

1718
namespace boost {

include/boost/compute/device.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
#ifndef BOOST_COMPUTE_DEVICE_HPP
1212
#define BOOST_COMPUTE_DEVICE_HPP
1313

14+
#include <algorithm>
1415
#include <string>
1516
#include <vector>
1617

17-
#include <boost/range/algorithm.hpp>
18-
#include <boost/algorithm/string.hpp>
18+
#include <boost/algorithm/string/split.hpp>
19+
#include <boost/algorithm/string/classification.hpp>
1920

2021
#include <boost/compute/config.hpp>
2122
#include <boost/compute/exception.hpp>
@@ -213,7 +214,8 @@ class device
213214
{
214215
const std::vector<std::string> extensions = this->extensions();
215216

216-
return boost::find(extensions, name) != extensions.end();
217+
return std::find(
218+
extensions.begin(), extensions.end(), name) != extensions.end();
217219
}
218220

219221
/// Returns the number of address bits.

include/boost/compute/platform.hpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
#ifndef BOOST_COMPUTE_PLATFORM_HPP
1212
#define BOOST_COMPUTE_PLATFORM_HPP
1313

14+
#include <algorithm>
1415
#include <string>
1516
#include <vector>
1617

17-
#include <boost/range/algorithm.hpp>
18-
#include <boost/algorithm/string.hpp>
18+
#include <boost/algorithm/string/split.hpp>
19+
#include <boost/algorithm/string/classification.hpp>
1920

2021
#include <boost/compute/cl.hpp>
2122
#include <boost/compute/device.hpp>
@@ -112,7 +113,8 @@ class platform
112113
{
113114
const std::vector<std::string> extensions = this->extensions();
114115

115-
return boost::find(extensions, name) != extensions.end();
116+
return std::find(
117+
extensions.begin(), extensions.end(), name) != extensions.end();
116118
}
117119

118120
/// Returns a list of devices on the platform.

include/boost/compute/system.hpp

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <vector>
1616
#include <cstdlib>
1717

18-
#include <boost/foreach.hpp>
1918
#include <boost/throw_exception.hpp>
2019

2120
#include <boost/compute/cl.hpp>
@@ -85,7 +84,10 @@ class system
8584
/// \throws no_device_found if no device with \p name is found.
8685
static device find_device(const std::string &name)
8786
{
88-
BOOST_FOREACH(const device &device, devices()){
87+
const std::vector<device> devices = system::devices();
88+
for(size_t i = 0; i < devices.size(); i++){
89+
const device& device = devices[i];
90+
8991
if(device.name() == name){
9092
return device;
9193
}
@@ -108,10 +110,13 @@ class system
108110
{
109111
std::vector<device> devices;
110112

111-
BOOST_FOREACH(const platform &platform, platforms()){
112-
BOOST_FOREACH(const device &device, platform.devices()){
113-
devices.push_back(device);
114-
}
113+
const std::vector<platform> platforms = system::platforms();
114+
for(size_t i = 0; i < platforms.size(); i++){
115+
const std::vector<device> platform_devices = platforms[i].devices();
116+
117+
devices.insert(
118+
devices.end(), platform_devices.begin(), platform_devices.end()
119+
);
115120
}
116121

117122
return devices;
@@ -122,8 +127,9 @@ class system
122127
{
123128
size_t count = 0;
124129

125-
BOOST_FOREACH(const platform &platform, platforms()){
126-
count += platform.device_count();
130+
const std::vector<platform> platforms = system::platforms();
131+
for(size_t i = 0; i < platforms.size(); i++){
132+
count += platforms[i].device_count();
127133
}
128134

129135
return count;
@@ -214,7 +220,8 @@ class system
214220
const char *vendor = detail::getenv("BOOST_COMPUTE_DEFAULT_VENDOR");
215221

216222
if(name || type || platform || vendor){
217-
BOOST_FOREACH(const device &device, devices_){
223+
for(size_t i = 0; i < devices_.size(); i++){
224+
const device& device = devices_[i];
218225
if (name && !matches(device.name(), name))
219226
continue;
220227

@@ -237,14 +244,18 @@ class system
237244
}
238245

239246
// find the first gpu device
240-
BOOST_FOREACH(const device &device, devices_){
247+
for(size_t i = 0; i < devices_.size(); i++){
248+
const device& device = devices_[i];
249+
241250
if(device.type() == device::gpu){
242251
return device;
243252
}
244253
}
245254

246255
// find the first cpu device
247-
BOOST_FOREACH(const device &device, devices_){
256+
for(size_t i = 0; i < devices_.size(); i++){
257+
const device& device = devices_[i];
258+
248259
if(device.type() == device::cpu){
249260
return device;
250261
}

include/boost/compute/types/fundamental.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
#include <cstring>
1515
#include <ostream>
1616

17-
#include <boost/preprocessor.hpp>
17+
#include <boost/preprocessor/cat.hpp>
18+
#include <boost/preprocessor/comma.hpp>
19+
#include <boost/preprocessor/repetition.hpp>
20+
#include <boost/preprocessor/stringize.hpp>
1821

1922
#include <boost/compute/cl.hpp>
2023

include/boost/compute/types/tuple.hpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
#include <string>
1515
#include <utility>
1616

17+
#include <boost/preprocessor/enum.hpp>
18+
#include <boost/preprocessor/expr_if.hpp>
19+
#include <boost/preprocessor/repetition.hpp>
1720
#include <boost/tuple/tuple.hpp>
1821

1922
#include <boost/compute/config.hpp>
@@ -25,8 +28,6 @@
2528
#include <tuple>
2629
#endif
2730

28-
#include <boost/preprocessor/repetition.hpp>
29-
3031
namespace boost {
3132
namespace compute {
3233
namespace detail {

0 commit comments

Comments
 (0)