Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.


// Copyright (c) 2013 Kyle Lutz <>
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// See for more information.


#include <exception>

namespace boost {
namespace compute {

class context;

/// \class context_error
/// \brief A run-time OpenCL context error.
/// The context_error exception is thrown when the OpenCL context encounters
/// an error condition. Boost.Compute is notified of these error conditions by
/// registering an error handler when creating context objects (via the
/// \c pfn_notify argument to the \c clCreateContext() function).
/// This exception is different than the opencl_error exception which is thrown
/// as a result of error caused when calling a single OpenCL API function.
/// \see opencl_error
class context_error : public std::exception
    /// Creates a new context error exception object.
    context_error(const context *context,
                  const char *errinfo,
                  const void *private_info,
                  size_t private_info_size) throw()
        : m_context(context),

    /// Destroys the context error object.
    ~context_error() throw()

    /// Returns a string with a description of the error.
    const char* what() const throw()
        return m_errinfo;

    /// Returns a pointer to the context object which generated the error
    /// notification.
    const context* get_context_ptr() const throw()
        return m_context;

    /// Returns a pointer to the private info memory block.
    const void* get_private_info_ptr() const throw()
        return m_private_info;

    /// Returns the size of the private info memory block.
    size_t get_private_info_size() const throw()
        return m_private_info_size;

    const context *m_context;
    const char *m_errinfo;
    const void *m_private_info;
    size_t m_private_info_size;

} // end compute namespace
} // end boost namespace