Skip to content

Commit 5cbc8db

Browse files
committed
Eliminate dependency on Algorithm
1 parent caa7c11 commit 5cbc8db

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

src/pthread/thread.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <boost/thread/future.hpp>
2020
#include <boost/thread/pthread/pthread_helpers.hpp>
2121
#include <boost/thread/pthread/pthread_mutex_scoped_lock.hpp>
22+
#include <boost/thread/detail/string_trim.hpp>
2223

2324
#ifdef __GLIBC__
2425
#include <sys/sysinfo.h>
@@ -33,8 +34,6 @@
3334
#include <vxCpuLib.h>
3435
#endif
3536

36-
#include <boost/algorithm/string/split.hpp>
37-
#include <boost/algorithm/string/trim.hpp>
3837
#include <boost/lexical_cast.hpp>
3938

4039
#include <fstream>
@@ -535,16 +534,18 @@ namespace boost
535534
if (line.empty())
536535
continue;
537536

538-
vector<string> key_val(2);
539-
boost::split(key_val, line, boost::is_any_of(":"));
537+
std::size_t i = line.find( ':' );
540538

541-
if (key_val.size() != 2)
542-
return hardware_concurrency();
539+
if( i == std::string::npos )
540+
{
541+
return hardware_concurrency();
542+
}
543+
544+
std::string key = line.substr( 0, i );
545+
std::string value = line.substr( i+1 );
543546

544-
string key = key_val[0];
545-
string value = key_val[1];
546-
boost::trim(key);
547-
boost::trim(value);
547+
key = thread_detail::string_trim( key );
548+
value = thread_detail::string_trim( value );
548549

549550
if (key == physical_id) {
550551
current_core_entry.first = boost::lexical_cast<unsigned>(value);

0 commit comments

Comments
 (0)