Skip to content

Commit c736d6e

Browse files
committed
Add check_version() to platform class
1 parent 77fe5e8 commit c736d6e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

include/boost/compute/platform.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,23 @@ class platform
211211
return m_platform != other.m_platform;
212212
}
213213

214+
/// Returns \c true if the platform OpenCL version is major.minor
215+
/// or newer; otherwise returns \c false.
216+
bool check_version(int major, int minor) const
217+
{
218+
std::stringstream stream;
219+
stream << version();
220+
221+
int actual_major, actual_minor;
222+
stream.ignore(7); // 'OpenCL '
223+
stream >> actual_major;
224+
stream.ignore(1); // '.'
225+
stream >> actual_minor;
226+
227+
return actual_major > major ||
228+
(actual_major == major && actual_minor >= minor);
229+
}
230+
214231
private:
215232
cl_platform_id m_platform;
216233
};

0 commit comments

Comments
 (0)