code:
// Copyright (C) 2006 Douglas Gregor <doug.gregor -at- gmail.com>.

// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

/** @file nonblocking.hpp
 *
 *  This header defines operations for completing non-blocking
 *  communication requests.
 */
#ifndef BOOST_MPI_NONBLOCKING_HPP
#define BOOST_MPI_NONBLOCKING_HPP

#include <boost/mpi/config.hpp>
#include <vector>
#include <iterator> // for std::iterator_traits
#include <boost/optional.hpp>
#include <utility> // for std::pair
#include <algorithm> // for iter_swap, reverse
#include <boost/static_assert.hpp>
#include <boost/mpi/request.hpp>
#include <boost/mpi/status.hpp>
#include <boost/mpi/exception.hpp>

namespace boost { namespace mpi {

/**
 *  @brief Wait until any non-blocking request has completed.
 *
 *  This routine takes in a set of requests stored in the iterator
 *  range @c [first,last) and waits until any of these requests has
 *  been completed. It provides functionality equivalent to
 *  @c MPI_Waitany.
 *
 *  @param first The iterator that denotes the beginning of the
 *  sequence of request objects.
 *
 *  @param last The iterator that denotes the end of the sequence of
 *  request objects. This may not be equal to @c first.
 *
 *  @returns A pair containing the status object that corresponds to
 *  the completed operation and the iterator referencing the completed
 *  request.
 */
template<typename ForwardIterator>
std::pair<status, ForwardIterator>
wait_any(ForwardIterator first, ForwardIterator last)
{
  using std::advance;

  BOOST_ASSERT(first != last);

  typedef typename std::iterator_traits<ForwardIterator>::difference_type
    difference_type;

  bool all_trivial_requests = true;
  difference_type n = 0;
  ForwardIterator current = first;
  while (true) {
    // Check if we have found a completed request. If so, return it.
    if (current->m_requests[0] != MPI_REQUEST_NULL &&
        (current->m_requests[1] != MPI_REQUEST_NULL ||
         current->m_handler)) {
      if (optional<status> result = current->test())
        return std::make_pair(*result, current);
    }

    // Check if this request (and all others before it) are "trivial"
    // requests, e.g., they can be represented with a single
    // MPI_Request.
    all_trivial_requests =
      all_trivial_requests
      && !current->m_handler
      && current->m_requests[1] == MPI_REQUEST_NULL;

    // Move to the next request.
    ++n;
    if (++current == last) {
      // We have reached the end of the list. If all requests thus far
      // have been trivial, we can call MPI_Waitany directly, because
      // it may be more efficient than our busy-wait semantics.
      if (all_trivial_requests) {
        std::vector<MPI_Request> requests;
        requests.reserve(n);
        for (current = first; current != last; ++current)
          requests.push_back(current->m_requests[0]);

        // Let MPI wait until one of these operations completes.
        int index;
        status stat;
        BOOST_MPI_CHECK_RESULT(MPI_Waitany,
                               (n, &requests[0], &index, &stat.m_status));

        // We don't have a notion of empty requests or status objects,
        // so this is an error.
        if (index == MPI_UNDEFINED)
          boost::throw_exception(exception("MPI_Waitany", MPI_ERR_REQUEST));

        // Find the iterator corresponding to the completed request.
        current = first;
        advance(current, index);
        current->m_requests[0] = requests[index];
        return std::make_pair(stat, current);
      }

      // There are some nontrivial requests, so we must continue our
      // busy waiting loop.
      n = 0;
      current = first;
      all_trivial_requests = true;
    }
  }

  // We cannot ever get here
  BOOST_ASSERT(false);
}

/**
 *  @brief Test whether any non-blocking request has completed.
 *
 *  This routine takes in a set of requests stored in the iterator
 *  range @c [first,last) and tests whether any of these requests has
 *  been completed. This routine is similar to @c wait_any, but will
 *  not block waiting for requests to completed. It provides
 *  functionality equivalent to @c MPI_Testany.
 *
 *  @param first The iterator that denotes the beginning of the
 *  sequence of request objects.
 *
 *  @param last The iterator that denotes the end of the sequence of
 *  request objects.
 *
 *  @returns If any outstanding requests have completed, a pair
 *  containing the status object that corresponds to the completed
 *  operation and the iterator referencing the completed
 *  request. Otherwise, an empty @c optional<>.
 */
template<typename ForwardIterator>
optional<std::pair<status, ForwardIterator> >
test_any(ForwardIterator first, ForwardIterator last)
{
  while (first != last) {
    // Check if we have found a completed request. If so, return it.
    if (optional<status> result = first->test()) {
      return std::make_pair(*result, first);
    }
    ++first;
  }

  // We found nothing
  return optional<std::pair<status, ForwardIterator> >();
}

/**
 *  @brief Wait until all non-blocking requests have completed.
 *
 *  This routine takes in a set of requests stored in the iterator
 *  range @c [first,last) and waits until all of these requests have
 *  been completed. It provides functionality equivalent to
 *  @c MPI_Waitall.
 *
 *  @param first The iterator that denotes the beginning of the
 *  sequence of request objects.
 *
 *  @param last The iterator that denotes the end of the sequence of
 *  request objects.
 *
 *  @param out If provided, an output iterator through which the
 *  status of each request will be emitted. The @c status objects are
 *  emitted in the same order as the requests are retrieved from
 *  @c [first,last).
 *
 *  @returns If an @p out parameter was provided, the value @c out
 *  after all of the @c status objects have been emitted.
 */
template<typename ForwardIterator, typename OutputIterator>
OutputIterator
wait_all(ForwardIterator first, ForwardIterator last, OutputIterator out)
{
  typedef typename std::iterator_traits<ForwardIterator>::difference_type
    difference_type;

  using std::distance;

  difference_type num_outstanding_requests = distance(first, last);

  std::vector<status> results(num_outstanding_requests);
  std::vector<bool> completed(num_outstanding_requests);

  while (num_outstanding_requests > 0) {
    bool all_trivial_requests = true;
    difference_type idx = 0;
    for (ForwardIterator current = first; current != last; ++current, ++idx) {
      if (!completed[idx]) {
        if (optional<status> stat = current->test()) {
          // This outstanding request has been completed. We're done.
          results[idx] = *stat;
          completed[idx] = true;
          --num_outstanding_requests;
          all_trivial_requests = false;
        } else {
          // Check if this request (and all others before it) are "trivial"
          // requests, e.g., they can be represented with a single
          // MPI_Request.
          all_trivial_requests =
            all_trivial_requests
            && !current->m_handler
            && current->m_requests[1] == MPI_REQUEST_NULL;
        }
      }
    }

    // If we have yet to fulfill any requests and all of the requests
    // are trivial (i.e., require only a single MPI_Request to be
    // fulfilled), call MPI_Waitall directly.
    if (all_trivial_requests
        && num_outstanding_requests == (difference_type)results.size()) {
      std::vector<MPI_Request> requests;
      requests.reserve(num_outstanding_requests);
      for (ForwardIterator current = first; current != last; ++current)
        requests.push_back(current->m_requests[0]);

      // Let MPI wait until all of these operations completes.
      std::vector<MPI_Status> stats(num_outstanding_requests);
      BOOST_MPI_CHECK_RESULT(MPI_Waitall,
                             (num_outstanding_requests, &requests[0],
                              &stats[0]));

      for (std::vector<MPI_Status>::iterator i = stats.begin();
           i != stats.end(); ++i, ++out) {
        status stat;
        stat.m_status = *i;
        *out = stat;
      }

      return out;
    }

    all_trivial_requests = false;
  }

  return std::copy(results.begin(), results.end(), out);
}

/**
 * \overload
 */
template<typename ForwardIterator>
void
wait_all(ForwardIterator first, ForwardIterator last)
{
  typedef typename std::iterator_traits<ForwardIterator>::difference_type
    difference_type;

  using std::distance;

  difference_type num_outstanding_requests = distance(first, last);

  std::vector<bool> completed(num_outstanding_requests);

  while (num_outstanding_requests > 0) {
    bool all_trivial_requests = true;

    difference_type idx = 0;
    for (ForwardIterator current = first; current != last; ++current, ++idx) {
      if (!completed[idx]) {
        if (optional<status> stat = current->test()) {
          // This outstanding request has been completed.
          completed[idx] = true;
          --num_outstanding_requests;
          all_trivial_requests = false;
        } else {
          // Check if this request (and all others before it) are "trivial"
          // requests, e.g., they can be represented with a single
          // MPI_Request.
          all_trivial_requests =
            all_trivial_requests
            && !current->m_handler
            && current->m_requests[1] == MPI_REQUEST_NULL;
        }
      }
    }

    // If we have yet to fulfill any requests and all of the requests
    // are trivial (i.e., require only a single MPI_Request to be
    // fulfilled), call MPI_Waitall directly.
    if (all_trivial_requests
        && num_outstanding_requests == (difference_type)completed.size()) {
      std::vector<MPI_Request> requests;
      requests.reserve(num_outstanding_requests);
      for (ForwardIterator current = first; current != last; ++current)
        requests.push_back(current->m_requests[0]);

      // Let MPI wait until all of these operations completes.
      BOOST_MPI_CHECK_RESULT(MPI_Waitall,
                             (num_outstanding_requests, &requests[0],
                              MPI_STATUSES_IGNORE));

      // Signal completion
      num_outstanding_requests = 0;
    }
  }
}

/**
 *  @brief Tests whether all non-blocking requests have completed.
 *
 *  This routine takes in a set of requests stored in the iterator
 *  range @c [first,last) and determines whether all of these requests
 *  have been completed. However, due to limitations of the underlying
 *  MPI implementation, if any of the requests refers to a
 *  non-blocking send or receive of a serialized data type, @c
 *  test_all will always return the equivalent of @c false (i.e., the
 *  requests cannot all be finished at this time). This routine
 *  performs the same functionality as @c wait_all, except that this
 *  routine will not block. This routine provides functionality
 *  equivalent to @c MPI_Testall.
 *
 *  @param first The iterator that denotes the beginning of the
 *  sequence of request objects.
 *
 *  @param last The iterator that denotes the end of the sequence of
 *  request objects.
 *
 *  @param out If provided and all requests hav been completed, an
 *  output iterator through which the status of each request will be
 *  emitted. The @c status objects are emitted in the same order as
 *  the requests are retrieved from @c [first,last).
 *
 *  @returns If an @p out parameter was provided, the value @c out
 *  after all of the @c status objects have been emitted (if all
 *  requests were completed) or an empty @c optional<>. If no @p out
 *  parameter was provided, returns @c true if all requests have
 *  completed or @c false otherwise.
 */
template<typename ForwardIterator, typename OutputIterator>
optional<OutputIterator>
test_all(ForwardIterator first, ForwardIterator last, OutputIterator out)
{
  std::vector<MPI_Request> requests;
  for (; first != last; ++first) {
    // If we have a non-trivial request, then no requests can be
    // completed.
    if (first->m_handler || first->m_requests[1] != MPI_REQUEST_NULL)
      return optional<OutputIterator>();

    requests.push_back(first->m_requests[0]);
  }

  int flag = 0;
  int n = requests.size();
  std::vector<MPI_Status> stats(n);
  BOOST_MPI_CHECK_RESULT(MPI_Testall, (n, &requests[0], &flag, &stats[0]));
  if (flag) {
    for (int i = 0; i < n; ++i, ++out) {
      status stat;
      stat.m_status = stats[i];
      *out = stat;
    }
    return out;
  } else {
    return optional<OutputIterator>();
  }
}

/**
 *  \overload
 */
template<typename ForwardIterator>
bool
test_all(ForwardIterator first, ForwardIterator last)
{
  std::vector<MPI_Request> requests;
  for (; first != last; ++first) {
    // If we have a non-trivial request, then no requests can be
    // completed.
    if (first->m_handler || first->m_requests[1] != MPI_REQUEST_NULL)
      return false;

    requests.push_back(first->m_requests[0]);
  }

  int flag = 0;
  int n = requests.size();
  BOOST_MPI_CHECK_RESULT(MPI_Testall,
                         (n, &requests[0], &flag, MPI_STATUSES_IGNORE));
  return flag != 0;
}

/**
 *  @brief Wait until some non-blocking requests have completed.
 *
 *  This routine takes in a set of requests stored in the iterator
 *  range @c [first,last) and waits until at least one of the requests
 *  has completed. It then completes all of the requests it can,
 *  partitioning the input sequence into pending requests followed by
 *  completed requests. If an output iterator is provided, @c status
 *  objects will be emitted for each of the completed requests. This
 *  routine provides functionality equivalent to @c MPI_Waitsome.
 *
 *  @param first The iterator that denotes the beginning of the
 *  sequence of request objects.
 *
 *  @param last The iterator that denotes the end of the sequence of
 *  request objects. This may not be equal to @c first.
 *
 *  @param out If provided, the @c status objects corresponding to
 *  completed requests will be emitted through this output iterator.

 *  @returns If the @p out parameter was provided, a pair containing
 *  the output iterator @p out after all of the @c status objects have
 *  been written through it and an iterator referencing the first
 *  completed request. If no @p out parameter was provided, only the
 *  iterator referencing the first completed request will be emitted.
 */
template<typename BidirectionalIterator, typename OutputIterator>
std::pair<OutputIterator, BidirectionalIterator>
wait_some(BidirectionalIterator first, BidirectionalIterator last,
          OutputIterator out)
{
  using std::advance;

  if (first == last)
    return std::make_pair(out, first);

  typedef typename std::iterator_traits<BidirectionalIterator>::difference_type
    difference_type;

  bool all_trivial_requests = true;
  difference_type n = 0;
  BidirectionalIterator current = first;
  BidirectionalIterator start_of_completed = last;
  while (true) {
    // Check if we have found a completed request.
    if (optional<status> result = current->test()) {
      using std::iter_swap;

      // Emit the resulting status object
      *out++ = *result;

      // We're expanding the set of completed requests
      --start_of_completed;

      if (current == start_of_completed) {
        // If we have hit the end of the list of pending
        // requests. Finish up by fixing the order of the completed
        // set to match the order in which we emitted status objects,
        // then return.
        std::reverse(start_of_completed, last);
        return std::make_pair(out, start_of_completed);
      }

      // Swap the request we just completed with the last request that
      // has not yet been tested.
      iter_swap(current, start_of_completed);

      continue;
    }

    // Check if this request (and all others before it) are "trivial"
    // requests, e.g., they can be represented with a single
    // MPI_Request.
    all_trivial_requests =
      all_trivial_requests
      && !current->m_handler
      && current->m_requests[1] == MPI_REQUEST_NULL;

    // Move to the next request.
    ++n;
    if (++current == start_of_completed) {
      if (start_of_completed != last) {
        // We have satisfied some requests. Make the order of the
        // completed requests match that of the status objects we've
        // already emitted and we're done.
        std::reverse(start_of_completed, last);
        return std::make_pair(out, start_of_completed);
      }

      // We have reached the end of the list. If all requests thus far
      // have been trivial, we can call MPI_Waitsome directly, because
      // it may be more efficient than our busy-wait semantics.
      if (all_trivial_requests) {
        std::vector<MPI_Request> requests;
        std::vector<int> indices(n);
        std::vector<MPI_Status> stats(n);
        requests.reserve(n);
        for (current = first; current != last; ++current)
          requests.push_back(current->m_requests[0]);

        // Let MPI wait until some of these operations complete.
        int num_completed;
        BOOST_MPI_CHECK_RESULT(MPI_Waitsome,
                               (n, &requests[0], &num_completed, &indices[0],
                                &stats[0]));

        // Translate the index-based result of MPI_Waitsome into a
        // partitioning on the requests.
        int current_offset = 0;
        current = first;
        for (int index = 0; index < num_completed; ++index, ++out) {
          using std::iter_swap;

          // Move "current" to the request object at this index
          advance(current, indices[index] - current_offset);
          current_offset = indices[index];

          // Emit the status object
          status stat;
          stat.m_status = stats[index];
          *out = stat;

          // Finish up the request and swap it into the "completed
          // requests" partition.
          current->m_requests[0] = requests[indices[index]];
          --start_of_completed;
          iter_swap(current, start_of_completed);
        }

        // We have satisfied some requests. Make the order of the
        // completed requests match that of the status objects we've
        // already emitted and we're done.
        std::reverse(start_of_completed, last);
        return std::make_pair(out, start_of_completed);
      }

      // There are some nontrivial requests, so we must continue our
      // busy waiting loop.
      n = 0;
      current = first;
    }
  }

  // We cannot ever get here
  BOOST_ASSERT(false);
}

/**
 *  \overload
 */
template<typename BidirectionalIterator>
BidirectionalIterator
wait_some(BidirectionalIterator first, BidirectionalIterator last)
{
  using std::advance;

  if (first == last)
    return first;

  typedef typename std::iterator_traits<BidirectionalIterator>::difference_type
    difference_type;

  bool all_trivial_requests = true;
  difference_type n = 0;
  BidirectionalIterator current = first;
  BidirectionalIterator start_of_completed = last;
  while (true) {
    // Check if we have found a completed request.
    if (optional<status> result = current->test()) {
      using std::iter_swap;

      // We're expanding the set of completed requests
      --start_of_completed;

      // If we have hit the end of the list of pending requests, we're
      // done.
      if (current == start_of_completed)
        return start_of_completed;

      // Swap the request we just completed with the last request that
      // has not yet been tested.
      iter_swap(current, start_of_completed);

      continue;
    }

    // Check if this request (and all others before it) are "trivial"
    // requests, e.g., they can be represented with a single
    // MPI_Request.
    all_trivial_requests =
      all_trivial_requests
      && !current->m_handler
      && current->m_requests[1] == MPI_REQUEST_NULL;

    // Move to the next request.
    ++n;
    if (++current == start_of_completed) {
        // If we have satisfied some requests, we're done.
      if (start_of_completed != last)
        return start_of_completed;

      // We have reached the end of the list. If all requests thus far
      // have been trivial, we can call MPI_Waitsome directly, because
      // it may be more efficient than our busy-wait semantics.
      if (all_trivial_requests) {
        std::vector<MPI_Request> requests;
        std::vector<int> indices(n);
        requests.reserve(n);
        for (current = first; current != last; ++current)
          requests.push_back(current->m_requests[0]);

        // Let MPI wait until some of these operations complete.
        int num_completed;
        BOOST_MPI_CHECK_RESULT(MPI_Waitsome,
                               (n, &requests[0], &num_completed, &indices[0],
                                MPI_STATUSES_IGNORE));

        // Translate the index-based result of MPI_Waitsome into a
        // partitioning on the requests.
        int current_offset = 0;
        current = first;
        for (int index = 0; index < num_completed; ++index) {
          using std::iter_swap;

          // Move "current" to the request object at this index
          advance(current, indices[index] - current_offset);
          current_offset = indices[index];

          // Finish up the request and swap it into the "completed
          // requests" partition.
          current->m_requests[0] = requests[indices[index]];
          --start_of_completed;
          iter_swap(current, start_of_completed);
        }

        // We have satisfied some requests, so we are done.
        return start_of_completed;
      }

      // There are some nontrivial requests, so we must continue our
      // busy waiting loop.
      n = 0;
      current = first;
    }
  }

  // We cannot ever get here
  BOOST_ASSERT(false);
}

/**
 *  @brief Test whether some non-blocking requests have completed.
 *
 *  This routine takes in a set of requests stored in the iterator
 *  range @c [first,last) and tests to see if any of the requests has
 *  completed. It completes all of the requests it can, partitioning
 *  the input sequence into pending requests followed by completed
 *  requests. If an output iterator is provided, @c status objects
 *  will be emitted for each of the completed requests. This routine
 *  is similar to @c wait_some, but does not wait until any requests
 *  have completed. This routine provides functionality equivalent to
 *  @c MPI_Testsome.
 *
 *  @param first The iterator that denotes the beginning of the
 *  sequence of request objects.
 *
 *  @param last The iterator that denotes the end of the sequence of
 *  request objects. This may not be equal to @c first.
 *
 *  @param out If provided, the @c status objects corresponding to
 *  completed requests will be emitted through this output iterator.

 *  @returns If the @p out parameter was provided, a pair containing
 *  the output iterator @p out after all of the @c status objects have
 *  been written through it and an iterator referencing the first
 *  completed request. If no @p out parameter was provided, only the
 *  iterator referencing the first completed request will be emitted.
 */
template<typename BidirectionalIterator, typename OutputIterator>
std::pair<OutputIterator, BidirectionalIterator>
test_some(BidirectionalIterator first, BidirectionalIterator last,
          OutputIterator out)
{
  BidirectionalIterator current = first;
  BidirectionalIterator start_of_completed = last;
  while (current != start_of_completed) {
    // Check if we have found a completed request.
    if (optional<status> result = current->test()) {
      using std::iter_swap;

      // Emit the resulting status object
      *out++ = *result;

      // We're expanding the set of completed requests
      --start_of_completed;

      // Swap the request we just completed with the last request that
      // has not yet been tested.
      iter_swap(current, start_of_completed);

      continue;
    }

    // Move to the next request.
    ++current;
  }

  // Finish up by fixing the order of the completed set to match the
  // order in which we emitted status objects, then return.
  std::reverse(start_of_completed, last);
  return std::make_pair(out, start_of_completed);
}

/**
 *  \overload
 */
template<typename BidirectionalIterator>
BidirectionalIterator
test_some(BidirectionalIterator first, BidirectionalIterator last)
{
  BidirectionalIterator current = first;
  BidirectionalIterator start_of_completed = last;
  while (current != start_of_completed) {
    // Check if we have found a completed request.
    if (optional<status> result = current->test()) {
      using std::iter_swap;

      // We're expanding the set of completed requests
      --start_of_completed;

      // Swap the request we just completed with the last request that
      // has not yet been tested.
      iter_swap(current, start_of_completed);

      continue;
    }

    // Move to the next request.
    ++current;
  }

  return start_of_completed;
}

} } // end namespace boost::mpi

#endif // BOOST_MPI_NONBLOCKING_HPP


code:
/*=============================================================================
    Copyright (c) 2001-2011 Joel de Guzman

    Distributed under the Boost Software License, Version 1.0. (See accompanying
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

    This is an auto-generated file. Do not edit!
==============================================================================*/

#if FUSION_MAX_VECTOR_SIZE <= 10
#include <boost/fusion/container/vector/detail/cpp03/preprocessed/vvector10_fwd.hpp>
#elif FUSION_MAX_VECTOR_SIZE <= 20
#include <boost/fusion/container/vector/detail/cpp03/preprocessed/vvector20_fwd.hpp>
#elif FUSION_MAX_VECTOR_SIZE <= 30
#include <boost/fusion/container/vector/detail/cpp03/preprocessed/vvector30_fwd.hpp>
#elif FUSION_MAX_VECTOR_SIZE <= 40
#include <boost/fusion/container/vector/detail/cpp03/preprocessed/vvector40_fwd.hpp>
#elif FUSION_MAX_VECTOR_SIZE <= 50
#include <boost/fusion/container/vector/detail/cpp03/preprocessed/vvector50_fwd.hpp>
#else
#error "FUSION_MAX_VECTOR_SIZE out of bounds for preprocessed headers"
#endif

license: mit


code:
//  (C) Copyright John Maddock 2001 - 2003.
//  (C) Copyright Darin Adler 2001.
//  (C) Copyright Jens Maurer 2001 - 2003.
//  Use, modification and distribution are subject to the
//  Boost Software License, Version 1.0. (See accompanying file
//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

//  See http://www.boost.org for most recent version.

//  generic SGI STL:

#if !defined(__STL_CONFIG_H)
#  include <boost/config/no_tr1/utility.hpp>
#  if !defined(__STL_CONFIG_H)
#      error "This is not the SGI STL!"
#  endif
#endif

//
// No std::iterator traits without partial specialisation:
//
#if !defined(__STL_CLASS_PARTIAL_SPECIALIZATION)
#  define BOOST_NO_STD_ITERATOR_TRAITS
#endif

//
// No std::stringstream with gcc < 3
//
#if defined(__GNUC__) && (__GNUC__ < 3) && \
     ((__GNUC_MINOR__ < 95) || (__GNUC_MINOR__ == 96)) && \
     !defined(__STL_USE_NEW_IOSTREAMS) || \
   defined(__APPLE_CC__)
   // Note that we only set this for GNU C++ prior to 2.95 since the
   // latest patches for that release do contain a minimal <sstream>
   // If you are running a 2.95 release prior to 2.95.3 then this will need
   // setting, but there is no way to detect that automatically (other
   // than by running the configure script).
   // Also, the unofficial GNU C++ 2.96 included in RedHat 7.1 doesn't
   // have <sstream>.
#  define BOOST_NO_STRINGSTREAM
#endif

// Apple doesn't seem to reliably defined a *unix* macro
#if !defined(CYGWIN) && (  defined(__unix__)  \
                        || defined(__unix)    \
                        || defined(unix)      \
                        || defined(__APPLE__) \
                        || defined(__APPLE)   \
                        || defined(APPLE))
#  include <unistd.h>
#endif

//
// Assume no std::locale without own iostreams (this may be an
// incorrect assumption in some cases):
//
#if !defined(__SGI_STL_OWN_IOSTREAMS) && !defined(__STL_USE_NEW_IOSTREAMS)
#  define BOOST_NO_STD_LOCALE
#endif

//
// Original native SGI streams have non-standard std::messages facet:
//
#if defined(__sgi) && (_COMPILER_VERSION <= 650) && !defined(__SGI_STL_OWN_IOSTREAMS)
#  define BOOST_NO_STD_LOCALE
#endif

//
// SGI's new iostreams have missing "const" in messages<>::open
//
#if defined(__sgi) && (_COMPILER_VERSION <= 740) && defined(__STL_USE_NEW_IOSTREAMS)
#  define BOOST_NO_STD_MESSAGES
#endif

//
// No template iterator constructors, or std::allocator
// without member templates:
//
#if !defined(__STL_MEMBER_TEMPLATES)
#  define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
#  define BOOST_NO_STD_ALLOCATOR
#endif

//
// We always have SGI style hash_set, hash_map, and slist:
//
#define BOOST_HAS_HASH
#define BOOST_HAS_SLIST

//
// If this is GNU libstdc++2, then no <limits> and no std::wstring:
//
#if (defined(__GNUC__) && (__GNUC__ < 3))
#  include <string>
#  if defined(__BASTRING__)
#     define BOOST_NO_LIMITS
// Note: <boost/limits.hpp> will provide compile-time constants
#     undef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
#     define BOOST_NO_STD_WSTRING
#  endif
#endif

//
// There is no standard iterator unless we have namespace support:
//
#if !defined(__STL_USE_NAMESPACES)
#  define BOOST_NO_STD_ITERATOR
#endif

//
// Intrinsic type_traits support.
// The SGI STL has it's own __type_traits class, which
// has intrinsic compiler support with SGI's compilers.
// Whatever map SGI style type traits to boost equivalents:
//
#define BOOST_HAS_SGI_TYPE_TRAITS

//  C++0x headers not yet implemented
//
#  define BOOST_NO_CXX11_HDR_ARRAY
#  define BOOST_NO_CXX11_HDR_CHRONO
#  define BOOST_NO_CXX11_HDR_CODECVT
#  define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
#  define BOOST_NO_CXX11_HDR_FORWARD_LIST
#  define BOOST_NO_CXX11_HDR_FUTURE
#  define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
#  define BOOST_NO_CXX11_HDR_MUTEX
#  define BOOST_NO_CXX11_HDR_RANDOM
#  define BOOST_NO_CXX11_HDR_RATIO
#  define BOOST_NO_CXX11_HDR_REGEX
#  define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
#  define BOOST_NO_CXX11_HDR_THREAD
#  define BOOST_NO_CXX11_HDR_TUPLE
#  define BOOST_NO_CXX11_HDR_TYPE_TRAITS
#  define BOOST_NO_CXX11_HDR_TYPEINDEX
#  define BOOST_NO_CXX11_HDR_UNORDERED_MAP
#  define BOOST_NO_CXX11_HDR_UNORDERED_SET
#  define BOOST_NO_CXX11_NUMERIC_LIMITS
#  define BOOST_NO_CXX11_ALLOCATOR
#  define BOOST_NO_CXX11_ATOMIC_SMART_PTR
#  define BOOST_NO_CXX11_SMART_PTR
#  define BOOST_NO_CXX11_HDR_FUNCTIONAL
#  define BOOST_NO_CXX11_HDR_ATOMIC
#  define BOOST_NO_CXX11_STD_ALIGN
#  define BOOST_NO_CXX11_ADDRESSOF

#if defined(__has_include)
#if !__has_include(<shared_mutex>)
#  define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#elif __cplusplus < 201402
#  define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
#else
#  define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif

// C++14 features
#  define BOOST_NO_CXX14_STD_EXCHANGE

// C++17 features
#  define BOOST_NO_CXX17_STD_APPLY
#  define BOOST_NO_CXX17_STD_INVOKE

#define BOOST_STDLIB "SGI standard library"


code:
// Boost.Units - A C++ library for zero-overhead dimensional analysis and
// unit/quantity manipulation and conversion
//
// Copyright (C) 2003-2008 Matthias Christian Schabel
// Copyright (C) 2007-2008 Steven Watanabe
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

#ifndef BOOST_UNITS_DETAIL_PREVENT_REDEFINITION_HPP
#define BOOST_UNITS_DETAIL_PREVENT_REDEFINITION_HPP

#include <boost/mpl/long.hpp>

namespace boost {

namespace units {

namespace detail {

struct no { no() {} char dummy; };
struct yes { no dummy[2]; };

template<bool> struct ordinal_has_already_been_defined;

template<>
struct ordinal_has_already_been_defined<true>   { };

template<>
struct ordinal_has_already_been_defined<false>  { typedef void type; };

}

/// This must be in namespace boost::units so that ADL
/// will work.  we need a mangled name because it must
/// be found by ADL
/// INTERNAL ONLY
template<class T>
detail::no
boost_units_is_registered(const T&)
{ detail::no result; return(result); }

/// INTERNAL ONLY
template<class T>
detail::no
boost_units_unit_is_registered(const T&)
{ detail::no result; return(result); }

} // namespace units

} // namespace boost

#endif // BOOST_UNITS_PREVENT_ORDINAL_REDEFINITION_IMPL_HPP


code:
		Quick Start for DXpedition Mode
		-------------------------------

These notes are intended for operators already familiar with WSJT-X
and FT8 mode.  QSOs between the Dxpedition ("Fox") and other stations
("Hounds") are completed with as little as one transmission per Hound,
as in the following examples:

----------------------------------------------------------------------------
    Fox (300-600 Hz)                 Hounds
----------------------------------------------------------------------------
1.  CQ KH1DX AJ10
2.                                   KH1DX K1ABC FN42, KH1DX W9XYZ EN37, ...
3.  K1ABC KH1DX -13
4.                                   KH1DX K1ABC R-11
5.  K1ABC RR73; W9XYZ <KH1DX> -17
6.                                   KH1DX W9XYZ R-16
7.  W9XYZ RR73; G4AAA <KH1DX> -09
8.  ...
----------------------------------------------------------------------------

Everybody sets dial frequency to an agreed number and uses CAT control
with Split Operation (either *Rig* or *Fake It*).  Fox transmits up to
5 signals simultaneously, at audio frequencies 300, 360, ... 540
Hz.  Hounds make initial calls (e.g., line 2 above) anywhere in the
range 1000 - 4000 Hz.  They send "R+rpt" 350 Hz above the frequency
where Fox called them.

INSTRUCTIONS FOR FOX
--------------------

1. Start WSJT-X in FT8 mode.  Select *Fox* on the *Settings ->
Advanced tab*.  On the main window, check *Tx even/1st*, *Auto Seq*,
and *Hold Tx Freq*; uncheck *Call 1st*.  Set *Tx 300 Hz* and select
Tab 3.

2. In Fox mode the left window (called "Band Activity" in normal FT8
mode) is labeled "Stations calling DXpedition <MyCall>".  It will be
filled with a sorted list of calling Hounds.  You can sort by Call,
Grid, S/N, Distance, or Random order by using the comboBox at top
right of Tab 3.  You can limit the displayed Hound callsigns to those
no stronger than *Max dB*.  Fox might use this feature to discourage
Hounds from engaging in a QRO arms race.

3. *N Slots* sets the number of simultaneous Fox signals to be used.
Fox carries out as many as *N Slots* QSOs simultaneously.

4. *Repeats* sets the maximum number of repeat transmissions of the
same message.  A QSO is aborted when this number would be exceeded.

5. The *CQ* comboBox on Tab 3 offers a selection of directed CQ
messages.  *Reset* clears the QSO queue.

6. The Fox operator's main task is to select Hounds to be called and
worked.  The text box on Tab 3 holds the "QSO queue": a list of Hound
calls to be worked.  Hit Enter to select the top callsign from the
sorted list of callers (left window), or double-click on any
particular call.  Either actiion moves that Hound into the "QSO
queue".

7. The right window displays decodes of signals below 1000 Hz.
Normally these should include only Hound messages containing "R+rpt"
and Fox's own transmissions.

8. To get things started, toggle *Enable Tx* to red.  If a Hound call
is available in the QSO queue, that station will be called.  If the
QSO queue is empty, Fox calls CQ.

9. If you're using Nslots = 2 or higher, your signal no longer has
a constant envelope.  To avoid producing intermod sidebands you need
to ensure linearity in your Tx system.  One way to get things about right
is to use the WSJT-X *Tune* button to generate a pure tone.  Reduce the
Tx audio level until your power output decreases by 10% or so.  Use this
level for your Fox transmissions.

NOTE: If you are generating Nslots signals, the average power in each one
will be 1/Nslots^2 of its normal value for single-signal transmissions.

Nslots  Relative dB
-------------------
  1        0
  2       -6
  3      -9.5
  4      -12
  5      -14

The following features are not yet implemented for Fox:

1. Enforce all required settings
2. Tx message timeout
3. Manual abort of selected QSO
4. All Tx and Rx messages to all.txt
5. Additional sort criteria for Hound calls
6. Selectable timeout for keeping Hounds in the sorted list
7. Display number of active callers
8. Display QSO rate

INSTRUCTIONS FOR HOUND
----------------------

1. Start WSJT-X in FT8 mode.  Select *Hound* On the *Settings ->
Advanced* tab.  On the main window check *Auto Seq* and uncheck *Tx
even/1st*, *Call 1st*, and *Hold Tx Freq*.  Set *Tx nnnn Hz* to some
frequency between 1000 and 4000 Hz, and select *Tab 1*.  Enter Fox's
callsign and locator in DX Call and DX Grid, select Tx1, and start
*Monitor*.

2. When you have copied Fox, hit *Enable Tx* to call him.  You may
keep calling until he answers.  You may wish to move your TxFreq
around, hoping to find a clear calling frequency.

3. When you are called by Fox with a signal report, your next
transmission will automatically be sent as Tx3 ("R+rpt").  When Fox
receives that message he responds with "RR73", and your QSO is
complete!

The following features are not yet implemented for Hound:

1. Force all required settings
2. React properly to directed CQs from Fox
3. Disable Tx2, 4, 5, 6
4. For Tx1, enforce TxFreq >= 1000 Hz


code:
//
//! Copyright (c) 2011
//! Brandon Kohn
//
//  Distributed under the Boost Software License, Version 1.0. (See
//  accompanying file LICENSE_1_0.txt or copy at
//  http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef BOOST_NUMERIC_CAST_TRAITS_HPP
#define BOOST_NUMERIC_CAST_TRAITS_HPP

#include <boost/numeric/conversion/converter_policies.hpp>

namespace boost { namespace numeric {

    template <typename Target, typename Source, typename EnableIf = void>
    struct numeric_cast_traits
    {
        typedef def_overflow_handler    overflow_policy;
        typedef UseInternalRangeChecker range_checking_policy;
        typedef Trunc<Source>           rounding_policy;
    };

}}//namespace boost::numeric;

#if !defined( BOOST_NUMERIC_CONVERSION_RELAX_BUILT_IN_CAST_TRAITS )
#include <boost/cstdint.hpp>
#include <boost/numeric/conversion/detail/numeric_cast_traits.hpp>
#endif//!defined BOOST_NUMERIC_CONVERSION_RELAX_BUILT_IN_CAST_TRAITS

#endif//BOOST_NUMERIC_CAST_TRAITS_HPP


code:
//
//=======================================================================
// Copyright 1997, 1998, 1999, 2000 University of Notre Dame.
// Authors: Andrew Lumsdaine, Lie-Quan Lee, Jeremy G. Siek
//
// Copyright 2009, Andrew Sutton
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//=======================================================================
//
#ifndef BOOST_GRAPH_CONCEPTS_HPP
#define BOOST_GRAPH_CONCEPTS_HPP

#include <boost/config.hpp>
#include <boost/property_map/property_map.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/properties.hpp>
#include <boost/graph/numeric_values.hpp>
#include <boost/graph/buffer_concepts.hpp>
#include <boost/concept_check.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/not.hpp>
#include <boost/static_assert.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/concept/assert.hpp>

#include <boost/concept/detail/concept_def.hpp>
namespace boost
{
// dwa 2003/7/11 -- This clearly shouldn't be necessary, but if
// you want to use vector_as_graph, it is!  I'm sure the graph
// library leaves these out all over the place.  Probably a
// redesign involving specializing a template with a static
// member function is in order :(
//
// It is needed in order to allow us to write using boost::vertices as
// needed for ADL when using vector_as_graph below.
#if !defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)            \
 && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
# define BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
#endif

#ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
template <class T>
typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&);
#endif

    namespace concepts {
    BOOST_concept(MultiPassInputIterator,(T)) {
        BOOST_CONCEPT_USAGE(MultiPassInputIterator) {
            BOOST_CONCEPT_ASSERT((InputIterator<T>));
        }
    };

    BOOST_concept(Graph,(G))
    {
        typedef typename graph_traits<G>::vertex_descriptor vertex_descriptor;
        typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
        typedef typename graph_traits<G>::directed_category directed_category;
        typedef typename graph_traits<G>::edge_parallel_category edge_parallel_category;
        typedef typename graph_traits<G>::traversal_category traversal_category;

        BOOST_CONCEPT_USAGE(Graph)
        {
            BOOST_CONCEPT_ASSERT((DefaultConstructible<vertex_descriptor>));
            BOOST_CONCEPT_ASSERT((EqualityComparable<vertex_descriptor>));
            BOOST_CONCEPT_ASSERT((Assignable<vertex_descriptor>));
        }
        G g;
    };

    BOOST_concept(IncidenceGraph,(G))
        : Graph<G>
    {
        typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
        typedef typename graph_traits<G>::out_edge_iterator out_edge_iterator;
        typedef typename graph_traits<G>::degree_size_type degree_size_type;
        typedef typename graph_traits<G>::traversal_category traversal_category;

        BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<out_edge_iterator, void> >::value));
        BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<degree_size_type, void> >::value));

        BOOST_CONCEPT_USAGE(IncidenceGraph) {
            BOOST_CONCEPT_ASSERT((MultiPassInputIterator<out_edge_iterator>));
            BOOST_CONCEPT_ASSERT((DefaultConstructible<edge_descriptor>));
            BOOST_CONCEPT_ASSERT((EqualityComparable<edge_descriptor>));
            BOOST_CONCEPT_ASSERT((Assignable<edge_descriptor>));
            BOOST_CONCEPT_ASSERT((Convertible<traversal_category,
                                    incidence_graph_tag>));

            p = out_edges(u, g);
            n = out_degree(u, g);
            e = *p.first;
            u = source(e, g);
            v = target(e, g);
            const_constraints(g);
        }
        void const_constraints(const G& cg) {
            p = out_edges(u, cg);
            n = out_degree(u, cg);
            e = *p.first;
            u = source(e, cg);
            v = target(e, cg);
        }
        std::pair<out_edge_iterator, out_edge_iterator> p;
        typename graph_traits<G>::vertex_descriptor u, v;
        typename graph_traits<G>::edge_descriptor e;
        typename graph_traits<G>::degree_size_type n;
        G g;
    };

    BOOST_concept(BidirectionalGraph,(G))
        : IncidenceGraph<G>
    {
        typedef typename graph_traits<G>::in_edge_iterator
        in_edge_iterator;
        typedef typename graph_traits<G>::traversal_category
        traversal_category;

        BOOST_CONCEPT_USAGE(BidirectionalGraph) {
        BOOST_CONCEPT_ASSERT((MultiPassInputIterator<in_edge_iterator>));
        BOOST_CONCEPT_ASSERT((Convertible<traversal_category,
            bidirectional_graph_tag>));

        BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<in_edge_iterator, void> >::value));

        p = in_edges(v, g);
        n = in_degree(v, g);
        n = degree(v, g);
        e = *p.first;
        const_constraints(g);
        }
        void const_constraints(const G& cg) {
        p = in_edges(v, cg);
        n = in_degree(v, cg);
        n = degree(v, cg);
        e = *p.first;
        }
        std::pair<in_edge_iterator, in_edge_iterator> p;
        typename graph_traits<G>::vertex_descriptor v;
        typename graph_traits<G>::edge_descriptor e;
        typename graph_traits<G>::degree_size_type n;
        G g;
    };

    BOOST_concept(AdjacencyGraph,(G))
        : Graph<G>
    {
        typedef typename graph_traits<G>::adjacency_iterator
        adjacency_iterator;
        typedef typename graph_traits<G>::traversal_category
        traversal_category;

        BOOST_CONCEPT_USAGE(AdjacencyGraph) {
        BOOST_CONCEPT_ASSERT((MultiPassInputIterator<adjacency_iterator>));
        BOOST_CONCEPT_ASSERT((Convertible<traversal_category,
            adjacency_graph_tag>));

        BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<adjacency_iterator, void> >::value));

        p = adjacent_vertices(v, g);
        v = *p.first;
        const_constraints(g);
        }
        void const_constraints(const G& cg) {
        p = adjacent_vertices(v, cg);
        }
        std::pair<adjacency_iterator,adjacency_iterator> p;
        typename graph_traits<G>::vertex_descriptor v;
        G g;
    };

    BOOST_concept(VertexListGraph,(G))
        : Graph<G>
    {
        typedef typename graph_traits<G>::vertex_iterator vertex_iterator;
        typedef typename graph_traits<G>::vertices_size_type vertices_size_type;
        typedef typename graph_traits<G>::traversal_category
        traversal_category;

        BOOST_CONCEPT_USAGE(VertexListGraph) {
        BOOST_CONCEPT_ASSERT((MultiPassInputIterator<vertex_iterator>));
        BOOST_CONCEPT_ASSERT((Convertible<traversal_category,
            vertex_list_graph_tag>));

        BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<vertex_iterator, void> >::value));
        BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<vertices_size_type, void> >::value));

#ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
        // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if
        // you want to use vector_as_graph, it is!  I'm sure the graph
        // library leaves these out all over the place.  Probably a
        // redesign involving specializing a template with a static
        // member function is in order :(
        using boost::vertices;
#endif
        p = vertices(g);
        v = *p.first;
        const_constraints(g);
        }
        void const_constraints(const G& cg) {
#ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
        // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if
        // you want to use vector_as_graph, it is!  I'm sure the graph
        // library leaves these out all over the place.  Probably a
        // redesign involving specializing a template with a static
        // member function is in order :(
        using boost::vertices;
#endif

        p = vertices(cg);
        v = *p.first;
        V = num_vertices(cg);
        }
        std::pair<vertex_iterator,vertex_iterator> p;
        typename graph_traits<G>::vertex_descriptor v;
        G g;
        vertices_size_type V;
    };

    BOOST_concept(EdgeListGraph,(G))
        : Graph<G>
    {
        typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
        typedef typename graph_traits<G>::edge_iterator edge_iterator;
        typedef typename graph_traits<G>::edges_size_type edges_size_type;
        typedef typename graph_traits<G>::traversal_category
        traversal_category;

        BOOST_CONCEPT_USAGE(EdgeListGraph) {
        BOOST_CONCEPT_ASSERT((MultiPassInputIterator<edge_iterator>));
        BOOST_CONCEPT_ASSERT((DefaultConstructible<edge_descriptor>));
        BOOST_CONCEPT_ASSERT((EqualityComparable<edge_descriptor>));
        BOOST_CONCEPT_ASSERT((Assignable<edge_descriptor>));
        BOOST_CONCEPT_ASSERT((Convertible<traversal_category,
            edge_list_graph_tag>));

        BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<edge_iterator, void> >::value));
        BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<edges_size_type, void> >::value));

        p = edges(g);
        e = *p.first;
        u = source(e, g);
        v = target(e, g);
        const_constraints(g);
        }
        void const_constraints(const G& cg) {
        p = edges(cg);
        E = num_edges(cg);
        e = *p.first;
        u = source(e, cg);
        v = target(e, cg);
        }
        std::pair<edge_iterator,edge_iterator> p;
        typename graph_traits<G>::vertex_descriptor u, v;
        typename graph_traits<G>::edge_descriptor e;
        edges_size_type E;
        G g;
    };

    BOOST_concept(VertexAndEdgeListGraph,(G))
        : VertexListGraph<G>
        , EdgeListGraph<G>
    {
    };

    // Where to put the requirement for this constructor?
    //      G g(n_vertices);
    // Not in mutable graph, then LEDA graph's can't be models of
    // MutableGraph.
    BOOST_concept(EdgeMutableGraph,(G))
    {
        typedef typename graph_traits<G>::edge_descriptor edge_descriptor;

        BOOST_CONCEPT_USAGE(EdgeMutableGraph) {
        p = add_edge(u, v, g);
        remove_edge(u, v, g);
        remove_edge(e, g);
        clear_vertex(v, g);
        }
        G g;
        edge_descriptor e;
        std::pair<edge_descriptor, bool> p;
        typename graph_traits<G>::vertex_descriptor u, v;
    };

    BOOST_concept(VertexMutableGraph,(G))
    {

        BOOST_CONCEPT_USAGE(VertexMutableGraph) {
        v = add_vertex(g);
        remove_vertex(v, g);
        }
        G g;
        typename graph_traits<G>::vertex_descriptor u, v;
    };

    BOOST_concept(MutableGraph,(G))
        : EdgeMutableGraph<G>
        , VertexMutableGraph<G>
    {
    };

    template <class edge_descriptor>
    struct dummy_edge_predicate {
        bool operator()(const edge_descriptor&) const {
        return false;
        }
    };

    BOOST_concept(MutableIncidenceGraph,(G))
        : MutableGraph<G>
    {
        BOOST_CONCEPT_USAGE(MutableIncidenceGraph) {
        remove_edge(iter, g);
        remove_out_edge_if(u, p, g);
        }
        G g;
        typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
        dummy_edge_predicate<edge_descriptor> p;
        typename boost::graph_traits<G>::vertex_descriptor u;
        typename boost::graph_traits<G>::out_edge_iterator iter;
    };

    BOOST_concept(MutableBidirectionalGraph,(G))
        : MutableIncidenceGraph<G>
    {
        BOOST_CONCEPT_USAGE(MutableBidirectionalGraph)
        {
            remove_in_edge_if(u, p, g);
        }
        G g;
        typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
        dummy_edge_predicate<edge_descriptor> p;
        typename boost::graph_traits<G>::vertex_descriptor u;
    };

    BOOST_concept(MutableEdgeListGraph,(G))
        : EdgeMutableGraph<G>
    {
        BOOST_CONCEPT_USAGE(MutableEdgeListGraph) {
        remove_edge_if(p, g);
        }
        G g;
        typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
        dummy_edge_predicate<edge_descriptor> p;
    };

    BOOST_concept(VertexMutablePropertyGraph,(G))
        : VertexMutableGraph<G>
    {
        BOOST_CONCEPT_USAGE(VertexMutablePropertyGraph) {
        v = add_vertex(vp, g);
        }
        G g;
        typename graph_traits<G>::vertex_descriptor v;
        typename vertex_property_type<G>::type vp;
    };

    BOOST_concept(EdgeMutablePropertyGraph,(G))
        : EdgeMutableGraph<G>
    {
        typedef typename graph_traits<G>::edge_descriptor edge_descriptor;

        BOOST_CONCEPT_USAGE(EdgeMutablePropertyGraph) {
        p = add_edge(u, v, ep, g);
        }
        G g;
        std::pair<edge_descriptor, bool> p;
        typename graph_traits<G>::vertex_descriptor u, v;
        typename edge_property_type<G>::type ep;
    };

    BOOST_concept(AdjacencyMatrix,(G))
        : Graph<G>
    {
        typedef typename graph_traits<G>::edge_descriptor edge_descriptor;

        BOOST_CONCEPT_USAGE(AdjacencyMatrix) {
        p = edge(u, v, g);
        const_constraints(g);
        }
        void const_constraints(const G& cg) {
        p = edge(u, v, cg);
        }
        typename graph_traits<G>::vertex_descriptor u, v;
        std::pair<edge_descriptor, bool> p;
        G g;
    };

    BOOST_concept(ReadablePropertyGraph,(G)(X)(Property))
        : Graph<G>
    {
        typedef typename property_map<G, Property>::const_type const_Map;

        BOOST_CONCEPT_USAGE(ReadablePropertyGraph)
        {
        BOOST_CONCEPT_ASSERT((ReadablePropertyMapConcept<const_Map, X>));

        const_constraints(g);
        }
        void const_constraints(const G& cg) {
        const_Map pmap = get(Property(), cg);
        pval = get(Property(), cg, x);
        ignore_unused_variable_warning(pmap);
        }
        G g;
        X x;
        typename property_traits<const_Map>::value_type pval;
    };

    BOOST_concept(PropertyGraph,(G)(X)(Property))
        : ReadablePropertyGraph<G, X, Property>
    {
        typedef typename property_map<G, Property>::type Map;
        BOOST_CONCEPT_USAGE(PropertyGraph) {
        BOOST_CONCEPT_ASSERT((ReadWritePropertyMapConcept<Map, X>));

        Map pmap = get(Property(), g);
        pval = get(Property(), g, x);
        put(Property(), g, x, pval);
        ignore_unused_variable_warning(pmap);
        }
        G g;
        X x;
        typename property_traits<Map>::value_type pval;
    };

    BOOST_concept(LvaluePropertyGraph,(G)(X)(Property))
        : ReadablePropertyGraph<G, X, Property>
    {
        typedef typename property_map<G, Property>::type Map;
        typedef typename property_map<G, Property>::const_type const_Map;

        BOOST_CONCEPT_USAGE(LvaluePropertyGraph) {
        BOOST_CONCEPT_ASSERT((LvaluePropertyMapConcept<const_Map, X>));

        pval = get(Property(), g, x);
        put(Property(), g, x, pval);
        }
        G g;
        X x;
        typename property_traits<Map>::value_type pval;
    };

    // The *IndexGraph concepts are "semantic" graph concpepts. These can be
    // applied to describe any graph that has an index map that can be accessed
    // using the get(*_index, g) method. For example, adjacency lists with
    // VertexSet == vecS are implicitly models of this concept.
    //
    // NOTE: We could require an associated type vertex_index_type, but that
    // would mean propagating that type name into graph_traits and all of the
    // other graph implementations. Much easier to simply call it unsigned.

    BOOST_concept(VertexIndexGraph,(Graph))
    {
        BOOST_CONCEPT_USAGE(VertexIndexGraph)
        {
            typedef typename graph_traits<Graph>::vertex_descriptor Vertex;
            typedef typename property_map<Graph, vertex_index_t>::type Map;
            typedef unsigned Index; // This could be Graph::vertex_index_type
            Map m = get(vertex_index, g);
            Index x = get(vertex_index, g, Vertex());
            ignore_unused_variable_warning(m);
            ignore_unused_variable_warning(x);

            // This is relaxed
            renumber_vertex_indices(g);

            const_constraints(g);
        }
        void const_constraints(const Graph& g_)
        {
            typedef typename property_map<Graph, vertex_index_t>::const_type Map;
            Map m = get(vertex_index, g_);
            ignore_unused_variable_warning(m);
        }
    private:
        Graph g;
    };

    BOOST_concept(EdgeIndexGraph,(Graph))
    {
        BOOST_CONCEPT_USAGE(EdgeIndexGraph)
        {
            typedef typename graph_traits<Graph>::edge_descriptor Edge;
            typedef typename property_map<Graph, edge_index_t>::type Map;
            typedef unsigned Index; // This could be Graph::vertex_index_type
            Map m = get(edge_index, g);
            Index x = get(edge_index, g, Edge());
            ignore_unused_variable_warning(m);
            ignore_unused_variable_warning(x);

            // This is relaxed
            renumber_edge_indices(g);

            const_constraints(g);
        }
        void const_constraints(const Graph& g_)
        {
            typedef typename property_map<Graph, edge_index_t>::const_type Map;
            Map m = get(edge_index, g_);
            ignore_unused_variable_warning(m);
        }
    private:
        Graph g;
    };

    BOOST_concept(ColorValue,(C))
        : EqualityComparable<C>
        , DefaultConstructible<C>
    {
        BOOST_CONCEPT_USAGE(ColorValue) {
        c = color_traits<C>::white();
        c = color_traits<C>::gray();
        c = color_traits<C>::black();
        }
        C c;
    };

    BOOST_concept(BasicMatrix,(M)(I)(V))
    {
        BOOST_CONCEPT_USAGE(BasicMatrix) {
        V& elt = A[i][j];
        const_constraints(A);
        ignore_unused_variable_warning(elt);
        }
        void const_constraints(const M& cA) {
        const V& elt = cA[i][j];
        ignore_unused_variable_warning(elt);
        }
        M A;
        I i, j;
    };

    // The following concepts describe aspects of numberic values and measure
    // functions. We're extending the notion of numeric values to include
    // emulation for zero and infinity.

    BOOST_concept(NumericValue,(Numeric))
    {
        BOOST_CONCEPT_USAGE(NumericValue)
        {
            BOOST_CONCEPT_ASSERT(( DefaultConstructible<Numeric> ));
            BOOST_CONCEPT_ASSERT(( CopyConstructible<Numeric> ));
            numeric_values<Numeric>::zero();
            numeric_values<Numeric>::infinity();
        }
    };

    BOOST_concept(DegreeMeasure,(Measure)(Graph))
    {
        BOOST_CONCEPT_USAGE(DegreeMeasure)
        {
            typedef typename Measure::degree_type Degree;
            typedef typename Measure::vertex_type Vertex;

            Degree d = m(Vertex(), g);
            ignore_unused_variable_warning(d);
        }
    private:
        Measure m;
        Graph g;
    };

    BOOST_concept(DistanceMeasure,(Measure)(Graph))
    {
        BOOST_CONCEPT_USAGE(DistanceMeasure)
        {
            typedef typename Measure::distance_type Distance;
            typedef typename Measure::result_type Result;
            Result r = m(Distance(), g);
            ignore_unused_variable_warning(r);
        }
    private:
        Measure m;
        Graph g;
    };

} /* namespace concepts */

using boost::concepts::MultiPassInputIteratorConcept;

// Graph concepts
using boost::concepts::GraphConcept;
using boost::concepts::IncidenceGraphConcept;
using boost::concepts::BidirectionalGraphConcept;
using boost::concepts::AdjacencyGraphConcept;
using boost::concepts::VertexListGraphConcept;
using boost::concepts::EdgeListGraphConcept;
using boost::concepts::VertexAndEdgeListGraphConcept;
using boost::concepts::EdgeMutableGraphConcept;
using boost::concepts::VertexMutableGraphConcept;
using boost::concepts::MutableGraphConcept;
using boost::concepts::MutableIncidenceGraphConcept;
using boost::concepts::MutableBidirectionalGraphConcept;
using boost::concepts::MutableEdgeListGraphConcept;
using boost::concepts::VertexMutablePropertyGraphConcept;
using boost::concepts::EdgeMutablePropertyGraphConcept;
using boost::concepts::AdjacencyMatrixConcept;
using boost::concepts::ReadablePropertyGraphConcept;
using boost::concepts::PropertyGraphConcept;
using boost::concepts::LvaluePropertyGraphConcept;
using boost::concepts::VertexIndexGraphConcept;
using boost::concepts::EdgeIndexGraphConcept;

// Utility concepts
using boost::concepts::ColorValueConcept;
using boost::concepts::BasicMatrixConcept;
using boost::concepts::NumericValueConcept;
using boost::concepts::DistanceMeasureConcept;
using boost::concepts::DegreeMeasureConcept;

} /* namespace boost */
#include <boost/concept/detail/concept_undef.hpp>

#endif /* BOOST_GRAPH_CONCEPTS_H */


code:
//---------------------------------------------------------------------------//
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
// See http://boostorg.github.com/compute for more information.
//---------------------------------------------------------------------------//

#ifndef BOOST_COMPUTE_CONTAINER_HPP
#define BOOST_COMPUTE_CONTAINER_HPP

/// \file
///
/// Meta-header to include all Boost.Compute container headers.

#include <boost/compute/container/array.hpp>
#include <boost/compute/container/basic_string.hpp>
#include <boost/compute/container/dynamic_bitset.hpp>
#include <boost/compute/container/flat_map.hpp>
#include <boost/compute/container/flat_set.hpp>
#include <boost/compute/container/mapped_view.hpp>
#include <boost/compute/container/string.hpp>
#include <boost/compute/container/vector.hpp>

#endif // BOOST_COMPUTE_CONTAINER_HPP


code:
/* Copyright 2003-2013 Joaquin M Lopez Munoz.
 * Distributed under the Boost Software License, Version 1.0.
 * (See accompanying file LICENSE_1_0.txt or copy at
 * http://www.boost.org/LICENSE_1_0.txt)
 *
 * See http://www.boost.org/libs/multi_index for library home page.
 */

#ifndef BOOST_MULTI_INDEX_DETAIL_MODIFY_KEY_ADAPTOR_HPP
#define BOOST_MULTI_INDEX_DETAIL_MODIFY_KEY_ADAPTOR_HPP

#if defined(_MSC_VER)
#pragma once
#endif

namespace boost{

namespace multi_index{

namespace detail{

/* Functional adaptor to resolve modify_key as a call to modify.
 * Preferred over compose_f_gx and stuff cause it eliminates problems
 * with references to references, dealing with function pointers, etc.
 */

template<typename Fun,typename Value,typename KeyFromValue>
struct modify_key_adaptor
{

  modify_key_adaptor(Fun f_,KeyFromValue kfv_):f(f_),kfv(kfv_){}

  void operator()(Value& x)
  {
    f(kfv(x));
  }

private:
  Fun          f;
  KeyFromValue kfv;
};

} /* namespace multi_index::detail */

} /* namespace multi_index */

} /* namespace boost */

#endif


code:
/*==============================================================================
    Copyright (c) 2005-2010 Joel de Guzman
    Copyright (c) 2011 Thomas Heller

    Distributed under the Boost Software License, Version 1.0. (See accompanying
    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#ifndef BOOST_PHOENIX_FUNCTION_ADAPT_CALLABLE_HPP
#define BOOST_PHOENIX_FUNCTION_ADAPT_CALLABLE_HPP

#include <boost/phoenix/core/limits.hpp>
#include <boost/phoenix/core/detail/function_eval.hpp>
#include <boost/preprocessor/repetition/repeat.hpp>

#define BOOST_PHOENIX_ADAPT_CALLABLE_NULLARY(NAME, FUNC)                        \
    inline                                                                      \
    boost::phoenix::detail::expression::function_eval<FUNC>::type const         \
    NAME()                                                                      \
    {                                                                           \
        return boost::phoenix::detail::expression::                             \
                function_eval<FUNC>::make(FUNC());                              \
    }                                                                           \
/**/

#define BOOST_PHOENIX_ADAPT_CALLABLE(NAME, FUNC, N)                             \
    template <BOOST_PHOENIX_typename_A(N)>                                      \
    inline                                                                      \
    typename                                                                    \
        boost::phoenix::detail::expression::function_eval<                      \
            FUNC                                                                \
          , BOOST_PHOENIX_A(N)>::type const                                     \
    NAME(BOOST_PHOENIX_A_const_ref_a(N))                                        \
    {                                                                           \
        return boost::phoenix::detail::expression::                             \
            function_eval<FUNC, BOOST_PHOENIX_A(N)>::                           \
                make(FUNC(), BOOST_PHOENIX_a(N));                               \
    }                                                                           \
/**/

#define BOOST_PHOENIX_ADAPT_CALLABLE_VARARG(NAME, FUNC)                         \
    BOOST_PHOENIX_ADAPT_CALLABLE_NULLARY(NAME, FUNC)                            \
    BOOST_PP_REPEAT_FROM_TO(                                                    \
        1                                                                       \
      , BOOST_PHOENIX_LIMIT                                                     \
      , BOOST_PHOENIX_ADAPT_CALLABLE_VARARG_R                                   \
      , (NAME, FUNC)                                                            \
    )                                                                           \
/**/

#define BOOST_PHOENIX_ADAPT_CALLABLE_VARARG_R(Z, N, D)                          \
    BOOST_PHOENIX_ADAPT_CALLABLE(                                               \
        BOOST_PP_TUPLE_ELEM(2, 0, D)                                            \
      , BOOST_PP_TUPLE_ELEM(2, 1, D)                                            \
      , N                                                                       \
    )                                                                           \
/**/

#endif