code:
//  (C) Copyright Howard Hinnant
//  (C) Copyright 2011 Vicente J. Botet Escriba
//  Copyright (c) Microsoft Corporation 2014
//  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).
//

#ifndef BOOST_CHRONO_IO_TIME_POINT_UNITS_HPP
#define BOOST_CHRONO_IO_TIME_POINT_UNITS_HPP

#include <boost/chrono/config.hpp>
#include <boost/chrono/process_cpu_clocks.hpp>
#include <boost/chrono/system_clocks.hpp>
#include <boost/chrono/thread_clock.hpp>
#include <boost/chrono/io/ios_base_state.hpp>
#include <string>
#include <iostream>
#include <ios>
#include <locale>
#include <algorithm>

namespace boost
{
  namespace chrono
  {
    /**
     * customization point to the epoch associated to the clock @c Clock
     * The default calls @c f.do_get_epoch(Clock()). The user can overload this function.
     * @return the string epoch associated to the @c Clock
     */
    template <typename CharT, typename Clock, typename TPUFacet>
    std::basic_string<CharT> get_epoch_custom(Clock, TPUFacet& f)
    {
      return f.do_get_epoch(Clock());
    }

    /**
     * @c time_point_units facet gives useful information about the time_point pattern,
     * the text associated to a time_point's epoch,
     */
    template <typename CharT=char>
    class time_point_units: public std::locale::facet
    {
    public:
      /**
       * Type of character the facet is instantiated on.
       */
      typedef CharT char_type;
      /**
       * Type of character string used by member functions.
       */
      typedef std::basic_string<char_type> string_type;

      /**
       * Unique identifier for this type of facet.
       */
      static std::locale::id id;

      /**
       * Construct a @c time_point_units facet.
       * @param refs
       * @Effects Construct a @c time_point_units facet.
       * If the @c refs argument is @c 0 then destruction of the object is
       * delegated to the @c locale, or locales, containing it. This allows
       * the user to ignore lifetime management issues. On the other had,
       * if @c refs is @c 1 then the object must be explicitly deleted;
       * the @c locale will not do so. In this case, the object can be
       * maintained across the lifetime of multiple locales.
       */
      explicit time_point_units(size_t refs = 0) :
        std::locale::facet(refs)
      {
      }

      /**
       * @return the pattern to be used by default.
       */
      virtual string_type get_pattern() const =0;

      /**
       * @return the epoch associated to the clock @c Clock calling @c do_get_epoch(Clock())
       */
      template <typename Clock>
      string_type get_epoch() const
      {
        return get_epoch_custom<CharT>(Clock(), *this);
      }

    protected:
      /**
       * Destroy the facet.
       */
      virtual ~time_point_units() {}

    public:

      /**
       *
       * @param c a dummy instance of @c system_clock.
       * @return The epoch string associated to the @c system_clock.
       */
      virtual string_type do_get_epoch(system_clock) const=0;

      /**
       *
       * @param c a dummy instance of @c steady_clock.
       * @return The epoch string associated to the @c steady_clock.
       */
      virtual string_type do_get_epoch(steady_clock) const=0;

#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
      /**
       *
       * @param c a dummy instance of @c process_real_cpu_clock.
       * @return The epoch string associated to the @c process_real_cpu_clock.
       */
      virtual string_type do_get_epoch(process_real_cpu_clock) const=0;
#if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
      /**
       *
       * @param c a dummy instance of @c process_user_cpu_clock.
       * @return The epoch string associated to the @c process_user_cpu_clock.
       */
      virtual string_type do_get_epoch(process_user_cpu_clock) const=0;
      /**
       *
       * @param c a dummy instance of @c process_system_cpu_clock.
       * @return The epoch string associated to the @c process_system_cpu_clock.
       */
      virtual string_type do_get_epoch(process_system_cpu_clock) const=0;
      /**
       *
       * @param c a dummy instance of @c process_cpu_clock.
       * @return The epoch string associated to the @c process_cpu_clock.
       */
      virtual string_type do_get_epoch(process_cpu_clock) const=0;
#endif
#endif
#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
      /**
       *
       * @param c a dummy instance of @c thread_clock.
       * @return The epoch string associated to the @c thread_clock.
       */
      virtual string_type do_get_epoch(thread_clock) const=0;
#endif

    };

    template <typename CharT>
    std::locale::id time_point_units<CharT>::id;

    // This class is used to define the strings for the default English
    template <typename CharT=char>
    class time_point_units_default: public time_point_units<CharT>
    {
    public:
      /**
       * Type of character the facet is instantiated on.
       */
      typedef CharT char_type;
      /**
       * Type of character string returned by member functions.
       */
      typedef std::basic_string<char_type> string_type;

      explicit time_point_units_default(size_t refs = 0) :
        time_point_units<CharT> (refs)
      {
      }
      ~time_point_units_default() {}

      /**
       * @return the default pattern "%d%e".
       */
      string_type get_pattern() const
      {
        static const CharT t[] =
        { '%', 'd', '%', 'e' };
        static const string_type pattern(t, t + sizeof (t) / sizeof (t[0]));

        return pattern;
      }

    //protected:
      /**
       * @param c a dummy instance of @c system_clock.
       * @return The epoch string returned by @c clock_string<system_clock,CharT>::since().
       */
      string_type do_get_epoch(system_clock ) const
      {
        return clock_string<system_clock,CharT>::since();
      }
      /**
       * @param c a dummy instance of @c steady_clock.
       * @return The epoch string returned by @c clock_string<steady_clock,CharT>::since().
       */
      string_type do_get_epoch(steady_clock ) const
      {
        return clock_string<steady_clock,CharT>::since();
      }

#if defined(BOOST_CHRONO_HAS_PROCESS_CLOCKS)
      /**
       * @param c a dummy instance of @c process_real_cpu_clock.
       * @return The epoch string returned by @c clock_string<process_real_cpu_clock,CharT>::since().
       */
      string_type do_get_epoch(process_real_cpu_clock ) const
      {
        return clock_string<process_real_cpu_clock,CharT>::since();
      }
#if ! BOOST_OS_WINDOWS || BOOST_PLAT_WINDOWS_DESKTOP
      /**
       * @param c a dummy instance of @c process_user_cpu_clock.
       * @return The epoch string returned by @c clock_string<process_user_cpu_clock,CharT>::since().
       */
      string_type do_get_epoch(process_user_cpu_clock ) const
      {
        return clock_string<process_user_cpu_clock,CharT>::since();
      }
      /**
       * @param c a dummy instance of @c process_system_cpu_clock.
       * @return The epoch string returned by @c clock_string<process_system_cpu_clock,CharT>::since().
       */
      string_type do_get_epoch(process_system_cpu_clock ) const
      {
        return clock_string<process_system_cpu_clock,CharT>::since();
      }
      /**
       * @param c a dummy instance of @c process_cpu_clock.
       * @return The epoch string returned by @c clock_string<process_cpu_clock,CharT>::since().
       */
      string_type do_get_epoch(process_cpu_clock ) const
      {
        return clock_string<process_cpu_clock,CharT>::since();
      }

#endif
#endif
#if defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
      /**
       * @param c a dummy instance of @c thread_clock.
       * @return The epoch string returned by @c clock_string<thread_clock,CharT>::since().
       */
      string_type do_get_epoch(thread_clock ) const
      {
        return clock_string<thread_clock,CharT>::since();
      }
#endif

    };

  } // chrono

} // boost

#endif  // header


code:
/*
Copyright Rene Rivera 2008-2015
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_PREDEF_COMPILER_MPW_H
#define BOOST_PREDEF_COMPILER_MPW_H

#include <boost/predef/version_number.h>
#include <boost/predef/make.h>

/*`
[heading `BOOST_COMP_MPW`]

[@http://en.wikipedia.org/wiki/Macintosh_Programmer%27s_Workshop MPW C++] compiler.
Version number available as major, and minor.

[table
    [[__predef_symbol__] [__predef_version__]]

    [[`__MRC__`] [__predef_detection__]]
    [[`MPW_C`] [__predef_detection__]]
    [[`MPW_CPLUS`] [__predef_detection__]]

    [[`__MRC__`] [V.R.0]]
    ]
 */

#define BOOST_COMP_MPW BOOST_VERSION_NUMBER_NOT_AVAILABLE

#if defined(__MRC__) || defined(MPW_C) || defined(MPW_CPLUS)
#   if !defined(BOOST_COMP_MPW_DETECTION) && defined(__MRC__)
#       define BOOST_COMP_MPW_DETECTION BOOST_PREDEF_MAKE_0X_VVRR(__MRC__)
#   endif
#   if !defined(BOOST_COMP_MPW_DETECTION)
#       define BOOST_COMP_MPW_DETECTION BOOST_VERSION_NUMBER_AVAILABLE
#   endif
#endif

#ifdef BOOST_COMP_MPW_DETECTION
#   if defined(BOOST_PREDEF_DETAIL_COMP_DETECTED)
#       define BOOST_COMP_MPW_EMULATED BOOST_COMP_MPW_DETECTION
#   else
#       undef BOOST_COMP_MPW
#       define BOOST_COMP_MPW BOOST_COMP_MPW_DETECTION
#   endif
#   define BOOST_COMP_MPW_AVAILABLE
#   include <boost/predef/detail/comp_detected.h>
#endif

#define BOOST_COMP_MPW_NAME "MPW C++"

#endif

#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MPW,BOOST_COMP_MPW_NAME)

#ifdef BOOST_COMP_MPW_EMULATED
#include <boost/predef/detail/test.h>
BOOST_PREDEF_DECLARE_TEST(BOOST_COMP_MPW_EMULATED,BOOST_COMP_MPW_NAME)
#endif

license: mit


code:
//-----------------------------------------------------------------------------
// boost variant/detail/variant_io.hpp header file
// See http://www.boost.org for updates, documentation, and revision history.
//-----------------------------------------------------------------------------
//
// Copyright (c) 2002-2003
// Eric Friedman, Itay Maman
//
// 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_VARIANT_DETAIL_VARIANT_IO_HPP
#define BOOST_VARIANT_DETAIL_VARIANT_IO_HPP

#include <iosfwd> // for std::basic_ostream forward declare

#include <boost/variant/variant_fwd.hpp>

#include <boost/detail/templated_streams.hpp>
#include <boost/variant/static_visitor.hpp>

namespace boost {

///////////////////////////////////////////////////////////////////////////////
// function template operator<<
//
// Outputs the content of the given variant to the given ostream.
//

// forward declare (allows output of embedded variant< variant< ... >, ... >)
template <
      BOOST_TEMPLATED_STREAM_ARGS(E,T)
    BOOST_TEMPLATED_STREAM_COMMA
      BOOST_VARIANT_ENUM_PARAMS(typename U)
    >
inline BOOST_TEMPLATED_STREAM(ostream, E,T)& operator<<(
      BOOST_TEMPLATED_STREAM(ostream, E,T)& out
    , const variant< BOOST_VARIANT_ENUM_PARAMS(U) >& rhs
    );

namespace detail { namespace variant {

template <typename OStream>
class printer
    : public boost::static_visitor<>
{
private: // representation

    OStream& out_;

public: // structors

    explicit printer(OStream& out)
        : out_( out )
    {
    }

public: // visitor interface

    template <typename T>
    void operator()(const T& operand) const
    {
        out_ << operand;
    }

private:
    printer& operator=(const printer&);

};

}} // namespace detail::variant

template <
      BOOST_TEMPLATED_STREAM_ARGS(E,T)
    BOOST_TEMPLATED_STREAM_COMMA
      BOOST_VARIANT_ENUM_PARAMS(typename U)
    >
inline BOOST_TEMPLATED_STREAM(ostream, E,T)& operator<<(
      BOOST_TEMPLATED_STREAM(ostream, E,T)& out
    , const variant< BOOST_VARIANT_ENUM_PARAMS(U) >& rhs
    )
{
    detail::variant::printer<
          BOOST_TEMPLATED_STREAM(ostream, E,T)
        > visitor(out);

    rhs.apply_visitor(visitor);

    return out;
}

} // namespace boost

#endif // BOOST_VARIANT_DETAIL_VARIANT_IO_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!
==============================================================================*/
namespace boost { namespace fusion
{
    struct void_;
    struct set_tag;
    struct set_iterator_tag;
    template <
        typename T0 = void_ , typename T1 = void_ , typename T2 = void_ , typename T3 = void_ , typename T4 = void_ , typename T5 = void_ , typename T6 = void_ , typename T7 = void_ , typename T8 = void_ , typename T9 = void_ , typename T10 = void_ , typename T11 = void_ , typename T12 = void_ , typename T13 = void_ , typename T14 = void_ , typename T15 = void_ , typename T16 = void_ , typename T17 = void_ , typename T18 = void_ , typename T19 = void_ , typename T20 = void_ , typename T21 = void_ , typename T22 = void_ , typename T23 = void_ , typename T24 = void_ , typename T25 = void_ , typename T26 = void_ , typename T27 = void_ , typename T28 = void_ , typename T29 = void_
    >
    struct set;
}}


code:
//  (C) Copyright John Maddock 2007.
//  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)
//
//  This file is machine generated, do not edit by hand

// Polynomial evaluation using Horners rule
#ifndef BOOST_MATH_TOOLS_POLY_EVAL_5_HPP
#define BOOST_MATH_TOOLS_POLY_EVAL_5_HPP

namespace boost{ namespace math{ namespace tools{ namespace detail{

template <class T, class V>
inline V evaluate_polynomial_c_imp(const T*, const V&, const mpl::int_<0>*) BOOST_MATH_NOEXCEPT(V)
{
   return static_cast<V>(0);
}

template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V&, const mpl::int_<1>*) BOOST_MATH_NOEXCEPT(V)
{
   return static_cast<V>(a[0]);
}

template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<2>*) BOOST_MATH_NOEXCEPT(V)
{
   return static_cast<V>(a[1] * x + a[0]);
}

template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<3>*) BOOST_MATH_NOEXCEPT(V)
{
   return static_cast<V>((a[2] * x + a[1]) * x + a[0]);
}

template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<4>*) BOOST_MATH_NOEXCEPT(V)
{
   return static_cast<V>(((a[3] * x + a[2]) * x + a[1]) * x + a[0]);
}

template <class T, class V>
inline V evaluate_polynomial_c_imp(const T* a, const V& x, const mpl::int_<5>*) BOOST_MATH_NOEXCEPT(V)
{
   return static_cast<V>((((a[4] * x + a[3]) * x + a[2]) * x + a[1]) * x + a[0]);
}

}}}} // namespaces

#endif // include guard


code:
/*=============================================================================
    Copyright (c) 2005-2010 Joel de Guzman
    Copyright (c) 2010 Eric Niebler
    Copyright (c) 2010 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_CORE_IS_NULLARY_HPP
#define BOOST_PHOENIX_CORE_IS_NULLARY_HPP

#include <boost/phoenix/core/limits.hpp>
#include <boost/phoenix/core/environment.hpp>
#include <boost/phoenix/core/is_actor.hpp>
#include <boost/phoenix/core/meta_grammar.hpp>
#include <boost/phoenix/core/terminal_fwd.hpp>
#include <boost/phoenix/support/vector.hpp>
#include <boost/proto/transform/fold.hpp>
#include <boost/proto/transform/lazy.hpp>

namespace boost { namespace phoenix
{
    namespace result_of
    {
        template <typename Expr, typename Enable = void>
        struct is_nullary;
    }

    struct is_nullary
    {
        template <typename Rule, typename Dummy = void>
        struct when
            : proto::fold<
                proto::_
              , mpl::true_()
              , mpl::and_<
                    proto::_state
                  , proto::call<evaluator(proto::_, _context)>
                >()
            >
        {};
    };

    template <typename Dummy>
    struct is_nullary::when<rule::argument, Dummy>
    {
        BOOST_PROTO_TRANSFORM(is_nullary::when<rule::argument>)
        template <typename Expr, typename State, typename Data>
        struct impl
        {
            typedef mpl::false_ result_type;
        };
    };

    template <
        typename Trait
      , typename Expr
      , typename State
      , typename Data
      , bool IsTransform = proto::is_transform<Trait>::value
    >
    struct is_nullary_custom_terminal_impl
    {
        typedef typename Trait::type result_type;
    };

    template <typename Transform, typename Expr, typename State, typename Data>
    struct is_nullary_custom_terminal_impl<Transform, Expr, State, Data, true>
    {
        typedef
            typename Transform::template impl<
                Expr
              , State
              , Data
            >::result_type
            result_type;
    };

    template <typename Dummy>
    struct is_nullary::when<rule::custom_terminal, Dummy>
    {
        BOOST_PROTO_TRANSFORM(is_nullary::when<rule::custom_terminal>)

        template <typename Expr, typename State, typename Data>
        struct impl
            : is_nullary_custom_terminal_impl<
                result_of::is_nullary<
                    custom_terminal<
                        typename proto::detail::uncvref<
                            typename proto::result_of::value<Expr>::type
                        >::type
                    >
                >
              , typename proto::result_of::value<Expr>::type
              , State
              , Data
            >
        {};
    };

    template <typename Dummy>
    struct is_nullary::when<rule::terminal, Dummy>
    {
        BOOST_PROTO_TRANSFORM(is_nullary::when<rule::terminal>)
        template <typename Expr, typename State, typename Data>
        struct impl
        {
            typedef mpl::true_ result_type;
        };
    };

    namespace result_of
    {
        template <typename Expr, typename Enable>
        struct is_nullary
            : boost::phoenix::evaluator::impl<
                Expr const &
              , vector2<
                    mpl::true_
                  , boost::phoenix::is_nullary
                >
              , proto::empty_env
            >::result_type
        {};

        template <typename T>
        struct is_nullary<T & >
            : is_nullary<T>
        {};

        template <typename T>
        struct is_nullary<T const & >
            : is_nullary<T>
        {};

        template <typename T>
        struct is_nullary<T const >
            : is_nullary<T>
        {};

        template <typename T>
        struct is_nullary<custom_terminal<T> >
            : mpl::true_
        {};

        template <typename T>
        struct is_nullary<custom_terminal<actor<T> > >
            : evaluator
        {};

        template <typename T>
        struct is_nullary<custom_terminal<boost::reference_wrapper<actor<T> > > >
        {
            BOOST_PROTO_TRANSFORM(is_nullary<custom_terminal<boost::reference_wrapper<actor<T> > > >)
            template <typename Expr, typename State, typename Data>
            struct impl
            {
                typedef typename evaluator::template impl<actor<T>, State, Data>::result_type result_type;
            };
        };

        template <typename T>
        struct is_nullary<custom_terminal<boost::reference_wrapper<actor<T> const> > >
        {
            BOOST_PROTO_TRANSFORM(is_nullary<custom_terminal<boost::reference_wrapper<actor<T> const> > >)
            template <typename Expr, typename State, typename Data>
            struct impl
            {
                typedef typename evaluator::template impl<actor<T> const, State, Data>::result_type result_type;
            };
        };
    }

}}

#endif


code:
// Copyright Aleksey Gurtovoy 2000-2004
//
// 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)
//

// Preprocessed version of "boost/mpl/divides.hpp" header
// -- DO NOT modify by hand!

namespace boost { namespace mpl {

template<
      typename Tag1
    , typename Tag2
    >
struct divides_impl
    : if_c<
          ( BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag1)
              > BOOST_MPL_AUX_NESTED_VALUE_WKND(int, Tag2)
            )

        , aux::cast2nd_impl< divides_impl< Tag1,Tag1 >,Tag1, Tag2 >
        , aux::cast1st_impl< divides_impl< Tag2,Tag2 >,Tag1, Tag2 >
        >::type
{
};

/// for Digital Mars C++/compilers with no CTPS/TTP support
template<> struct divides_impl< na,na >
{
    template< typename U1, typename U2 > struct apply
    {
        typedef apply type;
        BOOST_STATIC_CONSTANT(int, value  = 0);
    };
};

template<> struct divides_impl< na,integral_c_tag >
{
    template< typename U1, typename U2 > struct apply
    {
        typedef apply type;
        BOOST_STATIC_CONSTANT(int, value  = 0);
    };
};

template<> struct divides_impl< integral_c_tag,na >
{
    template< typename U1, typename U2 > struct apply
    {
        typedef apply type;
        BOOST_STATIC_CONSTANT(int, value  = 0);
    };
};

template< typename T > struct divides_tag
{
    typedef typename T::tag type;
};

/// forward declaration

template<
      typename BOOST_MPL_AUX_NA_PARAM(N1)
    , typename BOOST_MPL_AUX_NA_PARAM(N2)
    >
struct divides2;

template<
      typename BOOST_MPL_AUX_NA_PARAM(N1)
    , typename BOOST_MPL_AUX_NA_PARAM(N2)
    , typename N3 = na, typename N4 = na, typename N5 = na
    >
struct divides

    : if_<

          is_na<N3>
        , divides2< N1,N2 >
        , divides<
              divides2< N1,N2 >
            , N3, N4, N5
            >
        >::type

{
    BOOST_MPL_AUX_LAMBDA_SUPPORT(
          5
        , divides
        , ( N1, N2, N3, N4, N5 )
        )
};

template<
      typename N1
    , typename N2
    >
struct divides2
    : divides_impl<
          typename divides_tag<N1>::type
        , typename divides_tag<N2>::type
        >::template apply< N1,N2 >::type
{
    BOOST_MPL_AUX_LAMBDA_SUPPORT(2, divides2, (N1, N2))

};

BOOST_MPL_AUX_NA_SPEC2(2, 5, divides)

}}

namespace boost { namespace mpl {
template<>
struct divides_impl< integral_c_tag,integral_c_tag >
{
    template< typename N1, typename N2 > struct apply

        : integral_c<
              typename aux::largest_int<
                  typename N1::value_type
                , typename N2::value_type
                >::type
            , ( BOOST_MPL_AUX_VALUE_WKND(N1)::value
                  / BOOST_MPL_AUX_VALUE_WKND(N2)::value
                )
            >
    {
    };
};

}}


code:
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
  message (FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
endif ()

file (READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string (REGEX REPLACE "\n" ";" files "${files}")
foreach (file ${files})
  message (STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
  if (EXISTS "$ENV{DESTDIR}${file}")
    exec_program (
      "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
      OUTPUT_VARIABLE rm_out
      RETURN_VALUE rm_retval
      )
    if ("${rm_retval}" STREQUAL 0)
    else ()
      message (FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
    endif ()
  else ()
    message (STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
  endif ()
endforeach ()


code:
// Simple bargraph meter
// Implemented by Edson Pereira PY2SDR

#include "meterwidget.h"

#include <QPainter>
#include <QPolygon>

#include "moc_meterwidget.cpp"

#define MAXDB 90

MeterWidget::MeterWidget(QWidget * parent)
  : QWidget {parent}
  , m_signal {0}
  , m_noisePeak {0}
  , m_sigPeak {0}
{
  for ( int i = 0; i < 10; i++ ) {
    signalQueue.enqueue(0);
  }
}

void MeterWidget::setValue(int value)
{
    m_signal = value;
    signalQueue.enqueue(value);
    signalQueue.dequeue();

    // Get signal peak
    int tmp = 0;
    for (int i = 0; i < signalQueue.size(); ++i) {
        if (signalQueue.at(i) > tmp)
            tmp = signalQueue.at(i);
    }
    m_noisePeak = tmp;

    update();
}

QSize MeterWidget::sizeHint () const
{
  return {10, 100};
}

void MeterWidget::paintEvent (QPaintEvent * event)
{
  QWidget::paintEvent (event);

  // Sanitize
  m_signal = m_signal < 0 ? 0 : m_signal;
  m_signal = m_signal > MAXDB ? MAXDB : m_signal;

  QPainter p {this};
  p.setPen (Qt::NoPen);

  auto const& target = contentsRect ();
  QRect r {QPoint {target.left (), static_cast<int> (target.top () + target.height () - m_signal / (double)MAXDB * target.height ())}
    , QPoint {target.right (), target.bottom ()}};
  p.setBrush (QColor(85,170,85));
  if (m_sigPeak > 85) {
      p.setBrush(Qt::red);
  }
  else if (m_noisePeak < 15) {
      p.setBrush(QColor(232,81,0));
  }
  p.drawRect (r);

  if (m_noisePeak)
    {
      // Draw peak hold indicator
      auto peak = static_cast<int> (target.top () + target.height () - m_noisePeak / (double)MAXDB * target.height ());
      p.setBrush (Qt::black);
      p.translate (target.left (), peak);
      p.drawPolygon (QPolygon {{{0, -4}, {0, 4}, {target.width (), 0}}});
    }
}

//
void MeterWidget::set_sigPeak(int value)
{
    m_sigPeak = value;
}


code:
/*=============================================================================
    Copyright (c) 2002-2003 Joel de Guzman
    Copyright (c) 2002-2003 Martin Wille
    http://spirit.sourceforge.net/

    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)
=============================================================================*/
#if !defined BOOST_SPIRIT_OBJECT_WITH_ID_IPP
#define BOOST_SPIRIT_OBJECT_WITH_ID_IPP

#include <vector>
#include <boost/shared_ptr.hpp>

#ifdef BOOST_SPIRIT_THREADSAFE
#include <boost/thread/mutex.hpp>
#include <boost/thread/lock_types.hpp>
#include <boost/thread/once.hpp>
#endif

#include <boost/spirit/home/classic/namespace.hpp>

///////////////////////////////////////////////////////////////////////////////
namespace boost { namespace spirit {

BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN

    namespace impl {

        //////////////////////////////////
        template <typename IdT = std::size_t>
        struct object_with_id_base_supply
        {
            typedef IdT                     object_id;
            typedef std::vector<object_id>  id_vector;

            object_with_id_base_supply() : max_id(object_id()) {}

#ifdef BOOST_SPIRIT_THREADSAFE
            boost::mutex        mutex;
#endif
            object_id           max_id;
            id_vector           free_ids;

            object_id           acquire();
            void                release(object_id);
        };

        //////////////////////////////////
        template <typename TagT, typename IdT = std::size_t>
        struct object_with_id_base
        {
            typedef TagT        tag_t;
            typedef IdT         object_id;

        protected:

            object_id           acquire_object_id();
            void                release_object_id(object_id);

        private:
#ifdef BOOST_SPIRIT_THREADSAFE
            static boost::mutex &mutex_instance();
            static void mutex_init();
#endif

            boost::shared_ptr<object_with_id_base_supply<IdT> > id_supply;
        };

        //////////////////////////////////
        template<class TagT, typename IdT = std::size_t>
        struct object_with_id : private object_with_id_base<TagT, IdT>
        {
            typedef object_with_id<TagT, IdT>       self_t;
            typedef object_with_id_base<TagT, IdT>  base_t;
            typedef IdT                             object_id;

            object_with_id() : id(base_t::acquire_object_id()) {}
            object_with_id(self_t const &other)
                : base_t(other)
                , id(base_t::acquire_object_id())
            {} // don't copy id
            self_t &operator = (self_t const &other)
            {   // don't assign id
                base_t::operator=(other);
                return *this;
            }
            ~object_with_id() { base_t::release_object_id(id); }
            object_id get_object_id() const { return id; }

        private:

            object_id const id;
        };

        //////////////////////////////////
        template <typename IdT>
        inline IdT
        object_with_id_base_supply<IdT>::acquire()
        {
#ifdef BOOST_SPIRIT_THREADSAFE
            boost::unique_lock<boost::mutex> lock(mutex);
#endif
            if (free_ids.size())
            {
                object_id id = *free_ids.rbegin();
                free_ids.pop_back();
                return id;
            }
            else
            {
                if (free_ids.capacity()<=max_id)
                    free_ids.reserve(max_id*3/2+1);
                return ++max_id;
            }
        }

        //////////////////////////////////
        template <typename IdT>
        inline void
        object_with_id_base_supply<IdT>::release(IdT id)
        {
#ifdef BOOST_SPIRIT_THREADSAFE
            boost::unique_lock<boost::mutex> lock(mutex);
#endif
            if (max_id == id)
                max_id--;
            else
                free_ids.push_back(id); // doesn't throw
        }

        //////////////////////////////////
        template <typename TagT, typename IdT>
        inline IdT
        object_with_id_base<TagT, IdT>::acquire_object_id()
        {
            {
#ifdef BOOST_SPIRIT_THREADSAFE
#ifndef BOOST_THREAD_PROVIDES_ONCE_CXX11
                static boost::once_flag been_here = BOOST_ONCE_INIT;
#else
                static boost::once_flag been_here;
#endif
                boost::call_once(been_here, mutex_init);
                boost::mutex &mutex = mutex_instance();
                boost::unique_lock<boost::mutex> lock(mutex);
#endif
                static boost::shared_ptr<object_with_id_base_supply<IdT> >
                    static_supply;

                if (!static_supply.get())
                    static_supply.reset(new object_with_id_base_supply<IdT>());
                id_supply = static_supply;
            }

            return id_supply->acquire();
        }

        //////////////////////////////////
        template <typename TagT, typename IdT>
        inline void
        object_with_id_base<TagT, IdT>::release_object_id(IdT id)
        {
            id_supply->release(id);
        }

        //////////////////////////////////
#ifdef BOOST_SPIRIT_THREADSAFE
        template <typename TagT, typename IdT>
        inline boost::mutex &
        object_with_id_base<TagT, IdT>::mutex_instance()
        {
            static boost::mutex mutex;
            return mutex;
        }
#endif

        //////////////////////////////////
#ifdef BOOST_SPIRIT_THREADSAFE
        template <typename TagT, typename IdT>
        inline void
        object_with_id_base<TagT, IdT>::mutex_init()
        {
            mutex_instance();
        }
#endif

    } // namespace impl

///////////////////////////////////////////////////////////////////////////////
BOOST_SPIRIT_CLASSIC_NAMESPACE_END

}} // namespace boost::spirit

#endif


code:
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)

    #include <boost/proto/detail/preprocessed/args.hpp>

#elif !defined(BOOST_PP_IS_ITERATING)

    /// INTERNAL ONLY
    ///
    #define BOOST_PROTO_DEFINE_CHILD_N(Z, N, DATA)                                              \
        typedef BOOST_PP_CAT(Arg, N) BOOST_PP_CAT(child, N);                                    \
        /**< INTERNAL ONLY */

    /// INTERNAL ONLY
    ///
    #define BOOST_PROTO_DEFINE_VOID_N(z, n, data)                                               \
        typedef mpl::void_ BOOST_PP_CAT(child, n);                                              \
        /**< INTERNAL ONLY */

    #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
        #pragma wave option(preserve: 2, line: 0, output: "preprocessed/args.hpp")
    #endif

    ///////////////////////////////////////////////////////////////////////////////
    /// \file args.hpp
    /// Contains definition of \c term\<\>, \c list1\<\>, \c list2\<\>, ...
    /// class templates.
    //
    //  Copyright 2008 Eric Niebler. 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)

    #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
        #pragma wave option(preserve: 1)
    #endif

    /// \brief A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
    ///
    /// A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
    /// The types in the sequence correspond to the children of a node in an expression tree.
    template< typename Arg0 >
    struct term
    {
        static const long arity = 0;
        typedef Arg0 child0;
        BOOST_PP_REPEAT_FROM_TO(1, BOOST_PROTO_MAX_ARITY, BOOST_PROTO_DEFINE_VOID_N, ~)

        /// INTERNAL ONLY
        ///
        typedef Arg0 back_;
    };

    #define BOOST_PP_ITERATION_PARAMS_1                                                         \
        (3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/args.hpp>))
    #include BOOST_PP_ITERATE()

    #if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
        #pragma wave option(output: null)
    #endif

    #undef BOOST_PROTO_DEFINE_VOID_N
    #undef BOOST_PROTO_DEFINE_CHILD_N

#else

    #define N BOOST_PP_ITERATION()

    /// \brief A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
    ///
    /// A type sequence, for use as the 2nd parameter to the \c expr\<\> class template.
    /// The types in the sequence correspond to the children of a node in an expression tree.
    template< BOOST_PP_ENUM_PARAMS(N, typename Arg) >
    struct BOOST_PP_CAT(list, N)
    {
        static const long arity = N;
        BOOST_PP_REPEAT(N, BOOST_PROTO_DEFINE_CHILD_N, ~)
        BOOST_PP_REPEAT_FROM_TO(N, BOOST_PROTO_MAX_ARITY, BOOST_PROTO_DEFINE_VOID_N, ~)

        /// INTERNAL ONLY
        ///
        typedef BOOST_PP_CAT(Arg, BOOST_PP_DEC(N)) back_;
    };

    #undef N

#endif


code:
//  (C) Copyright Gennadiy Rozental 2001.
//  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/test for the library home page.
//
//  File        : $RCSfile$
//
//  Version     : $Revision: 74248 $
//
//  Description : toolbox implementation details
// ***************************************************************************

#ifndef BOOST_TEST_TOOLS_DETAIL_EXPRESSION_HOLDER_HPP_012705GER
#define BOOST_TEST_TOOLS_DETAIL_EXPRESSION_HOLDER_HPP_012705GER

#ifdef BOOST_NO_CXX11_AUTO_DECLARATIONS

#include <boost/test/detail/suppress_warnings.hpp>

//____________________________________________________________________________//

namespace boost {
namespace test_tools {
namespace tt_detail {

// ************************************************************************** //
// **************         tt_detail::expression_holder         ************** //
// ************************************************************************** //

class expression_holder {
public:
    virtual                     ~expression_holder() {}
    virtual assertion_result    evaluate( bool no_message = false )  const = 0;
};

//____________________________________________________________________________//

template<typename E>
class  expression_holder_t: public expression_holder {
public:
    explicit                    expression_holder_t( E const& e ) : m_expr( e ) {}

private:
    virtual assertion_result    evaluate( bool no_message = false )  const { return m_expr.evaluate( no_message ); }

    E                           m_expr;
};

//____________________________________________________________________________//

template<typename E>
expression_holder_t<E>
hold_expression( E const& e )
{
    return expression_holder_t<E>( e );
}

//____________________________________________________________________________//

} // namespace tt_detail
} // namespace test_tools
} // namespace boost

#include <boost/test/detail/enable_warnings.hpp>

#endif

#endif // BOOST_TEST_TOOLS_DETAIL_EXPRESSION_HOLDER_HPP_012705GER


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)
==============================================================================*/
#if !defined(FUSION_FRONT_10022005_1618)
#define FUSION_FRONT_10022005_1618

#include <boost/fusion/support/config.hpp>
#include <boost/mpl/front.hpp>
#include <boost/fusion/sequence/intrinsic/begin.hpp>
#include <boost/fusion/iterator/value_of.hpp>

namespace boost { namespace mpl
{
    template <typename Tag>
    struct front_impl;

    template <>
    struct front_impl<fusion::fusion_sequence_tag>
    {
        template <typename Sequence>
        struct apply :
            fusion::result_of::value_of<typename fusion::result_of::begin<Sequence>::type> {};
    };
}}

#endif


code:
/* Viterbi decoder for arbitrary convolutional code
 * viterbi27 and viterbi37 for the r=1/2 and r=1/3 K=7 codes are faster
 * Copyright 1999 Phil Karn, KA9Q
 * May be used under the terms of the GNU Public License
 */

/* Select code here */

#define V216

#ifdef V216
#define	K 16			/* Constraint length */
#define N 2			/* Number of symbols per data bit */
#define Polys	Poly216		/* Select polynomials here */
#endif

/* Rate 1/2 codes */
unsigned int Poly216[] = {0126723, 0152711};	/* k = 16  */

#include <stdlib.h>
#include <memory.h>

#define LONGBITS 32
#define LOGLONGBITS 5

#undef max
#define max(x,y) ((x) > (y) ? (x) : (y))
#define D       (1 << max(0,K-LOGLONGBITS-1))
#define MAXNBITS 200            /* Maximum frame size (user bits) */

extern unsigned char Partab[];	/* Parity lookup table */

int Syms[1 << K];
int VDInit = 0;

int parity(int x)
{
  x ^= (x >> 16);
  x ^= (x >> 8);
  return Partab[x & 0xff];
}

// Wrapper for calling "encode" from Fortran:
//void __stdcall ENCODE(
void enc216_(
unsigned char data[],           // User data, 8 bits per byte
int *nbits,                     // Number of user bits
unsigned char symbols[],        // Encoded one-bit symbols, 8 per byte
int *nsymbols,                  // Number of symbols
int *kk,                        // K
int *nn)                        // N
{
  int nbytes;
  nbytes=(*nbits+7)/8;          // Always encode multiple of 8 information bits
  enc216(symbols,data,nbytes,0,0); // Do the encoding
  *nsymbols=(*nbits+K-1)*N;        // Return number of encoded symbols
  *kk=K;
  *nn=N;
}

/* Convolutionally encode data into binary symbols */
  enc216(unsigned char symbols[], unsigned char data[],
       unsigned int nbytes, unsigned int startstate,
       unsigned int endstate)
{
  int i,j,k,n=-1;
  unsigned int encstate = startstate;

  for(k=0; k<nbytes; k++) {
    for(i=7;i>=0;i--){
      encstate = (encstate + encstate) + ((data[k] >> i) & 1);
      for(j=0;j<N;j++) {
	n=n+1;
	symbols[n] = parity(encstate & Polys[j]);
      }
    }
  }
  // Flush out with zero tail.  (No need, if tail-biting code.)
  for(i=0; i<K-1;i++){
    encstate = (encstate << 1) | ((endstate >> i) & 1);
    for(j=0;j<N;j++) {
      n=n+1;
      symbols[n] = parity(encstate & Polys[j]);
    }
  }
  return 0;
}

// Wrapper for calling "viterbi" from Fortran:
//void __stdcall VITERBI(
void vit216_(
unsigned char symbols[],  /* Raw deinterleaved input symbols */
unsigned int *Nbits,	  /* Number of decoded information bits */
int mettab[2][256],	  /* Metric table, [sent sym][rx symbol] */
unsigned char ddec[],	  /* Decoded output data */
long *Metric              /* Final path metric (bigger is better) */
){
  long metric;
  vit216(&metric,ddec,symbols,*Nbits,mettab,0,0);
  *Metric=metric;
}

/* Viterbi decoder */
int vit216(
long *metric,           /* Final path metric (returned value) */
unsigned char *data,	/* Decoded output data */
unsigned char *symbols,	/* Raw deinterleaved input symbols */
unsigned int nbits,	/* Number of output bits */
int mettab[2][256],	/* Metric table, [sent sym][rx symbol] */
unsigned int startstate,         /* Encoder starting state */
unsigned int endstate            /* Encoder ending state */
){
  int bitcnt = -(K-1);
  long m0,m1;
  int i,j,sym,ipp;
  int mets[1 << N];
  unsigned long paths[(MAXNBITS+K-1)*D];
  unsigned long *pp,mask;
  long cmetric[1 << (K-1)],nmetric[1 << (K-1)];

  memset(paths,0,sizeof(paths));

  // Initialize on first time through:
  if(!VDInit){
    for(i=0;i<(1<<K);i++){
      sym = 0;
      for(j=0;j<N;j++)
	sym = (sym << 1) + parity(i & Polys[j]);
      Syms[i] = sym;
    }
    VDInit++;
  }

  // Keep only lower K-1 bits of specified startstate and endstate
  startstate &= ~((1<<(K-1)) - 1);
  endstate &=   ~((1<<(K-1)) - 1);

  /* Initialize starting metrics */
  for(i=0;i< 1<<(K-1);i++)
    cmetric[i] = -999999;
  cmetric[startstate] = 0;

  pp = paths;
  ipp=0;
  for(;;){ /* For each data bit */
    /* Read input symbols and compute branch metrics */
    for(i=0;i< 1<<N;i++){
      mets[i] = 0;
      for(j=0;j<N;j++){
	mets[i] += mettab[(i >> (N-j-1)) & 1][symbols[j]];
      }
    }
    symbols += N;
    /* Run the add-compare-select operations */
    mask = 1;
    for(i=0;i< 1 << (K-1);i+=2){
      int b1,b2;

      b1 = mets[Syms[i]];
      nmetric[i] = m0 = cmetric[i/2] + b1;
      b2 = mets[Syms[i+1]];
      b1 -= b2;
      m1 = cmetric[(i/2) + (1<<(K-2))] + b2;

      if(m1 > m0){
	nmetric[i] = m1;
	*pp |= mask;
      }

      m0 -= b1;
      nmetric[i+1] = m0;
      m1 += b1;

      if(m1 > m0){
	nmetric[i+1] = m1;
	*pp |= mask << 1;
      }

      mask <<= 2;
      if(mask == 0){
	mask = 1;
	pp++;
	ipp++;
      }
    }
    if(mask != 1){
      pp++;
      ipp++;
    }
    if(++bitcnt == nbits){
      *metric = nmetric[endstate];
      break;
    }
    memcpy(cmetric,nmetric,sizeof(cmetric));
  }

  /* Chain back from terminal state to produce decoded data */
  if(data == NULL)
    return 0;/* Discard output */
  memset(data,0,(nbits+7)/8); /* round up in case nbits % 8 != 0 */

  for(i=nbits-1;i >= 0;i--){
    //    int a0,a1;
    pp -= D;
    ipp -= D;
    m0=endstate >> LOGLONGBITS;
    m1=1L << (endstate & (LONGBITS-1));
    if(pp[m0] & m1) {
      //      a0=nmetric[endstate];
      endstate |= (1 << (K-1));
      //      a1=nmetric[endstate];
      data[i>>3] |= 0x80 >> (i&7);
      //      printf("B  %d  %d  %d  %d\n",*metric,i,a0,a1);
    }
    endstate >>= 1;
  }
  return 0;
}


code:
// Copyright David Abrahams 2002.
// 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 TO_PYTHON_FUNCTION_TYPE_DWA200236_HPP
# define TO_PYTHON_FUNCTION_TYPE_DWA200236_HPP
# include <boost/python/detail/prefix.hpp>
# include <boost/static_assert.hpp>

namespace boost { namespace python { namespace converter {

// The type of stored function pointers which actually do conversion
// by-value. The void* points to the object to be converted, and
// type-safety is preserved through runtime registration.
typedef PyObject* (*to_python_function_t)(void const*);

}}} // namespace boost::python::converter

#endif // TO_PYTHON_FUNCTION_TYPE_DWA200236_HPP


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_FLAT_MAP_HPP
#define BOOST_COMPUTE_CONTAINER_FLAT_MAP_HPP

#include <cstddef>
#include <utility>
#include <exception>

#include <boost/config.hpp>
#include <boost/throw_exception.hpp>

#include <boost/compute/exception.hpp>
#include <boost/compute/algorithm/find.hpp>
#include <boost/compute/algorithm/lower_bound.hpp>
#include <boost/compute/algorithm/upper_bound.hpp>
#include <boost/compute/container/vector.hpp>
#include <boost/compute/functional/get.hpp>
#include <boost/compute/iterator/transform_iterator.hpp>
#include <boost/compute/types/pair.hpp>
#include <boost/compute/detail/buffer_value.hpp>

namespace boost {
namespace compute {

template<class Key, class T>
class flat_map
{
public:
    typedef Key key_type;
    typedef T mapped_type;
    typedef typename ::boost::compute::vector<std::pair<Key, T> > vector_type;
    typedef typename vector_type::value_type value_type;
    typedef typename vector_type::size_type size_type;
    typedef typename vector_type::difference_type difference_type;
    typedef typename vector_type::reference reference;
    typedef typename vector_type::const_reference const_reference;
    typedef typename vector_type::pointer pointer;
    typedef typename vector_type::const_pointer const_pointer;
    typedef typename vector_type::iterator iterator;
    typedef typename vector_type::const_iterator const_iterator;
    typedef typename vector_type::reverse_iterator reverse_iterator;
    typedef typename vector_type::const_reverse_iterator const_reverse_iterator;

    explicit flat_map(const context &context = system::default_context())
        : m_vector(context)
    {
    }

    flat_map(const flat_map<Key, T> &other)
        : m_vector(other.m_vector)
    {
    }

    flat_map<Key, T>& operator=(const flat_map<Key, T> &other)
    {
        if(this != &other){
            m_vector = other.m_vector;
        }

        return *this;
    }

    ~flat_map()
    {
    }

    iterator begin()
    {
        return m_vector.begin();
    }

    const_iterator begin() const
    {
        return m_vector.begin();
    }

    const_iterator cbegin() const
    {
        return m_vector.cbegin();
    }

    iterator end()
    {
        return m_vector.end();
    }

    const_iterator end() const
    {
        return m_vector.end();
    }

    const_iterator cend() const
    {
        return m_vector.cend();
    }

    reverse_iterator rbegin()
    {
        return m_vector.rbegin();
    }

    const_reverse_iterator rbegin() const
    {
        return m_vector.rbegin();
    }

    const_reverse_iterator crbegin() const
    {
        return m_vector.crbegin();
    }

    reverse_iterator rend()
    {
        return m_vector.rend();
    }

    const_reverse_iterator rend() const
    {
        return m_vector.rend();
    }

    const_reverse_iterator crend() const
    {
        return m_vector.crend();
    }

    size_type size() const
    {
        return m_vector.size();
    }

    size_type max_size() const
    {
        return m_vector.max_size();
    }

    bool empty() const
    {
        return m_vector.empty();
    }

    size_type capacity() const
    {
        return m_vector.capacity();
    }

    void reserve(size_type size, command_queue &queue)
    {
        m_vector.reserve(size, queue);
    }

    void reserve(size_type size)
    {
        command_queue queue = m_vector.default_queue();
        reserve(size, queue);
        queue.finish();
    }

    void shrink_to_fit()
    {
        m_vector.shrink_to_fit();
    }

    void clear()
    {
        m_vector.clear();
    }

    std::pair<iterator, bool>
    insert(const value_type &value, command_queue &queue)
    {
        iterator location = upper_bound(value.first, queue);

        if(location != begin()){
            value_type current_value;
            ::boost::compute::copy_n(location - 1, 1, &current_value, queue);
            if(value.first == current_value.first){
                return std::make_pair(location - 1, false);
            }
        }

        m_vector.insert(location, value);
        return std::make_pair(location, true);
    }

    std::pair<iterator, bool> insert(const value_type &value)
    {
        command_queue queue = m_vector.default_queue();
        std::pair<iterator, bool> result = insert(value, queue);
        queue.finish();
        return result;
    }

    iterator erase(const const_iterator &position, command_queue &queue)
    {
        return erase(position, position + 1, queue);
    }

    iterator erase(const const_iterator &position)
    {
        command_queue queue = m_vector.default_queue();
        iterator iter = erase(position, queue);
        queue.finish();
        return iter;
    }

    iterator erase(const const_iterator &first,
                   const const_iterator &last,
                   command_queue &queue)
    {
        return m_vector.erase(first, last, queue);
    }

    iterator erase(const const_iterator &first, const const_iterator &last)
    {
        command_queue queue = m_vector.default_queue();
        iterator iter = erase(first, last, queue);
        queue.finish();
        return iter;
    }

    size_type erase(const key_type &value, command_queue &queue)
    {
        iterator position = find(value, queue);

        if(position == end()){
            return 0;
        }
        else {
            erase(position, queue);
            return 1;
        }
    }

    iterator find(const key_type &value, command_queue &queue)
    {
        ::boost::compute::get<0> get_key;

        return ::boost::compute::find(
                   ::boost::compute::make_transform_iterator(begin(), get_key),
                   ::boost::compute::make_transform_iterator(end(), get_key),
                   value,
                   queue
               ).base();
    }

    iterator find(const key_type &value)
    {
        command_queue queue = m_vector.default_queue();
        iterator iter = find(value, queue);
        queue.finish();
        return iter;
    }

    const_iterator find(const key_type &value, command_queue &queue) const
    {
        ::boost::compute::get<0> get_key;

        return ::boost::compute::find(
                   ::boost::compute::make_transform_iterator(begin(), get_key),
                   ::boost::compute::make_transform_iterator(end(), get_key),
                   value,
                   queue
               ).base();
    }

    const_iterator find(const key_type &value) const
    {
        command_queue queue = m_vector.default_queue();
        const_iterator iter = find(value, queue);
        queue.finish();
        return iter;
    }

    size_type count(const key_type &value, command_queue &queue) const
    {
        return find(value, queue) != end() ? 1 : 0;
    }

    size_type count(const key_type &value) const
    {
        command_queue queue = m_vector.default_queue();
        size_type result = count(value, queue);
        queue.finish();
        return result;
    }

    iterator lower_bound(const key_type &value, command_queue &queue)
    {
        ::boost::compute::get<0> get_key;

        return ::boost::compute::lower_bound(
                   ::boost::compute::make_transform_iterator(begin(), get_key),
                   ::boost::compute::make_transform_iterator(end(), get_key),
                   value,
                   queue
               ).base();
    }

    iterator lower_bound(const key_type &value)
    {
        command_queue queue = m_vector.default_queue();
        iterator iter = lower_bound(value, queue);
        queue.finish();
        return iter;
    }

    const_iterator lower_bound(const key_type &value, command_queue &queue) const
    {
        ::boost::compute::get<0> get_key;

        return ::boost::compute::lower_bound(
                   ::boost::compute::make_transform_iterator(begin(), get_key),
                   ::boost::compute::make_transform_iterator(end(), get_key),
                   value,
                   queue
               ).base();
    }

    const_iterator lower_bound(const key_type &value) const
    {
        command_queue queue = m_vector.default_queue();
        const_iterator iter = lower_bound(value, queue);
        queue.finish();
        return iter;
    }

    iterator upper_bound(const key_type &value, command_queue &queue)
    {
        ::boost::compute::get<0> get_key;

        return ::boost::compute::upper_bound(
                   ::boost::compute::make_transform_iterator(begin(), get_key),
                   ::boost::compute::make_transform_iterator(end(), get_key),
                   value,
                   queue
               ).base();
    }

    iterator upper_bound(const key_type &value)
    {
        command_queue queue = m_vector.default_queue();
        iterator iter = upper_bound(value, queue);
        queue.finish();
        return iter;
    }

    const_iterator upper_bound(const key_type &value, command_queue &queue) const
    {
        ::boost::compute::get<0> get_key;

        return ::boost::compute::upper_bound(
                   ::boost::compute::make_transform_iterator(begin(), get_key),
                   ::boost::compute::make_transform_iterator(end(), get_key),
                   value,
                   queue
               ).base();
    }

    const_iterator upper_bound(const key_type &value) const
    {
        command_queue queue = m_vector.default_queue();
        const_iterator iter = upper_bound(value, queue);
        queue.finish();
        return iter;
    }

    const mapped_type at(const key_type &key) const
    {
        const_iterator iter = find(key);
        if(iter == end()){
            BOOST_THROW_EXCEPTION(std::out_of_range("key not found"));
        }

        return value_type(*iter).second;
    }

    detail::buffer_value<mapped_type> operator[](const key_type &key)
    {
        iterator iter = find(key);
        if(iter == end()){
            iter = insert(std::make_pair(key, mapped_type())).first;
        }

        size_t index = iter.get_index() * sizeof(value_type) + sizeof(key_type);

        return detail::buffer_value<mapped_type>(m_vector.get_buffer(), index);
    }

private:
    ::boost::compute::vector<std::pair<Key, T> > m_vector;
};

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

#endif // BOOST_COMPUTE_CONTAINER_FLAT_MAP_HPP


code:
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// xml_woarchive_impl.ipp:

// (C) Copyright 2002 Robert Ramey - http://www.rrsd.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)

#include <boost/config.hpp>
#ifndef BOOST_NO_STD_WSTREAMBUF

#include <ostream>
#include <string>
#include <algorithm> // std::copy
#include <locale>
#include <exception>

#include <cstring> // strlen
#include <cstdlib> // mbtowc
#include <cwchar>  // wcslen

#include <boost/config.hpp>
#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
    using ::strlen;
    #if ! defined(BOOST_NO_INTRINSIC_WCHAR_T)
        using ::mbtowc;
        using ::wcslen;
    #endif
} // namespace std
#endif

#include <boost/archive/xml_woarchive.hpp>
#include <boost/archive/detail/utf8_codecvt_facet.hpp>

#include <boost/serialization/throw_exception.hpp>

#include <boost/archive/iterators/xml_escape.hpp>
#include <boost/archive/iterators/wchar_from_mb.hpp>
#include <boost/archive/iterators/ostream_iterator.hpp>
#include <boost/archive/iterators/dataflow_exception.hpp>

namespace boost {
namespace archive {

/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// implemenations of functions specific to wide char archives

// copy chars to output escaping to xml and widening characters as we go
template<class InputIterator>
void save_iterator(std::wostream &os, InputIterator begin, InputIterator end){
    typedef iterators::wchar_from_mb<
        iterators::xml_escape<InputIterator>
    > xmbtows;
    std::copy(
        xmbtows(begin),
        xmbtows(end),
        boost::archive::iterators::ostream_iterator<wchar_t>(os)
    );
}

template<class Archive>
BOOST_WARCHIVE_DECL void
xml_woarchive_impl<Archive>::save(const std::string & s){
    // note: we don't use s.begin() and s.end() because dinkumware
    // doesn't have string::value_type defined. So use a wrapper
    // around these values to implement the definitions.
    const char * begin = s.data();
    const char * end = begin + s.size();
    save_iterator(os, begin, end);
}

#ifndef BOOST_NO_STD_WSTRING
template<class Archive>
BOOST_WARCHIVE_DECL void
xml_woarchive_impl<Archive>::save(const std::wstring & ws){
#if 0
    typedef iterators::xml_escape<std::wstring::const_iterator> xmbtows;
    std::copy(
        xmbtows(ws.begin()),
        xmbtows(ws.end()),
        boost::archive::iterators::ostream_iterator<wchar_t>(os)
    );
#endif
    typedef iterators::xml_escape<const wchar_t *> xmbtows;
    std::copy(
        xmbtows(ws.data()),
        xmbtows(ws.data() + ws.size()),
        boost::archive::iterators::ostream_iterator<wchar_t>(os)
    );
}
#endif //BOOST_NO_STD_WSTRING

template<class Archive>
BOOST_WARCHIVE_DECL void
xml_woarchive_impl<Archive>::save(const char * s){
   save_iterator(os, s, s + std::strlen(s));
}

#ifndef BOOST_NO_INTRINSIC_WCHAR_T
template<class Archive>
BOOST_WARCHIVE_DECL void
xml_woarchive_impl<Archive>::save(const wchar_t * ws){
    os << ws;
    typedef iterators::xml_escape<const wchar_t *> xmbtows;
    std::copy(
        xmbtows(ws),
        xmbtows(ws + std::wcslen(ws)),
        boost::archive::iterators::ostream_iterator<wchar_t>(os)
    );
}
#endif

template<class Archive>
BOOST_WARCHIVE_DECL
xml_woarchive_impl<Archive>::xml_woarchive_impl(
    std::wostream & os_,
    unsigned int flags
) :
    basic_text_oprimitive<std::wostream>(
        os_,
        true // don't change the codecvt - use the one below
    ),
    basic_xml_oarchive<Archive>(flags)
{
    if(0 == (flags & no_codecvt)){
        std::locale l = std::locale(
            os_.getloc(),
            new boost::archive::detail::utf8_codecvt_facet
        );
        os_.flush();
        os_.imbue(l);
    }
    if(0 == (flags & no_header))
        this->init();
}

template<class Archive>
BOOST_WARCHIVE_DECL
xml_woarchive_impl<Archive>::~xml_woarchive_impl(){
    if(std::uncaught_exception())
        return;
    if(0 == (this->get_flags() & no_header)){
        save(L"</boost_serialization>\n");
    }
}

template<class Archive>
BOOST_WARCHIVE_DECL void
xml_woarchive_impl<Archive>::save_binary(
    const void *address,
    std::size_t count
){
    this->end_preamble();
    #if ! defined(__MWERKS__)
    this->basic_text_oprimitive<std::wostream>::save_binary(
    #else
    this->basic_text_oprimitive::save_binary(
    #endif
        address,
        count
    );
    this->indent_next = true;
}

} // namespace archive
} // namespace boost

#endif //BOOST_NO_STD_WSTREAMBUF


code:
//  (C) Copyright Gennadiy Rozental 2001.
//  Use, modification, and distribution are subject to the
//  Boost Software License, Version 1.0. (See accompanying file
//  http://www.boost.org/LICENSE_1_0.txt)

//  See http://www.boost.org/libs/test for the library home page.
//
//  File        : $RCSfile$
//
//  Version     : $Revision$
//
//  Description : debug interfaces implementation
// ***************************************************************************

#ifndef BOOST_TEST_DEBUG_API_IPP_112006GER
#define BOOST_TEST_DEBUG_API_IPP_112006GER

// Boost.Test
#include <boost/test/detail/config.hpp>
#include <boost/test/detail/workaround.hpp>
#include <boost/test/detail/global_typedef.hpp>

#include <boost/test/debug.hpp>
#include <boost/test/debug_config.hpp>

// Implementation on Windows
#if defined(_WIN32) && !defined(UNDER_CE) && !defined(BOOST_DISABLE_WIN32) // ******* WIN32

#  define BOOST_WIN32_BASED_DEBUG

// SYSTEM API
#  include <windows.h>
#  include <winreg.h>
#  include <cstdio>
#  include <cstring>

#  if !defined(NDEBUG) && defined(_MSC_VER)
#    define BOOST_MS_CRT_BASED_DEBUG
#    include <crtdbg.h>
#  endif

#  ifdef BOOST_NO_STDC_NAMESPACE
namespace std { using ::memset; using ::sprintf; }
#  endif

#elif defined(unix) || defined(__unix) // ********************* UNIX

#  define BOOST_UNIX_BASED_DEBUG

// Boost.Test
#include <boost/test/utils/class_properties.hpp>
#include <boost/test/utils/algorithm.hpp>

// STL
#include <cstring>  // std::memcpy
#include <map>
#include <cstdio>
#include <stdarg.h> // !! ?? cstdarg

// SYSTEM API
#  include <unistd.h>
#  include <signal.h>
#  include <fcntl.h>

#  include <sys/types.h>
#  include <sys/stat.h>
#  include <sys/wait.h>
#  include <sys/time.h>
#  include <stdio.h>
#  include <stdlib.h>

#  if defined(sun) || defined(__sun)

#    define BOOST_SUN_BASED_DEBUG

#    ifndef BOOST_TEST_DBG_LIST
#      define BOOST_TEST_DBG_LIST dbx;gdb
#    endif

#    define BOOST_TEST_CNL_DBG  dbx
#    define BOOST_TEST_GUI_DBG  dbx-ddd

#    include <procfs.h>

#  elif defined(linux) || defined(__linux)

#    define BOOST_LINUX_BASED_DEBUG

#    include <sys/ptrace.h>

#    ifndef BOOST_TEST_STAT_LINE_MAX
#      define BOOST_TEST_STAT_LINE_MAX 500
#    endif

#    ifndef BOOST_TEST_DBG_LIST
#      define BOOST_TEST_DBG_LIST gdb
#    endif

#    define BOOST_TEST_CNL_DBG  gdb
#    define BOOST_TEST_GUI_DBG  gdb-xterm

#  endif

#endif

#include <boost/test/detail/suppress_warnings.hpp>

//____________________________________________________________________________//

namespace boost {
namespace debug {

using unit_test::const_string;

// ************************************************************************** //
// **************                debug::info_t                 ************** //
// ************************************************************************** //

namespace {

#if defined(BOOST_WIN32_BASED_DEBUG) // *********************** WIN32

template<typename T>
inline void
dyn_symbol( T& res, char const* module_name, char const* symbol_name )
{
    HMODULE m = ::GetModuleHandleA( module_name );

    if( !m )
        m = ::LoadLibraryA( module_name );

    res = reinterpret_cast<T>( ::GetProcAddress( m, symbol_name ) );
}

//____________________________________________________________________________//

static struct info_t {
    typedef BOOL (WINAPI* IsDebuggerPresentT)();
    typedef LONG (WINAPI* RegQueryValueExT)( HKEY, char const* /*LPTSTR*/, LPDWORD, LPDWORD, LPBYTE, LPDWORD );
    typedef LONG (WINAPI* RegOpenKeyT)( HKEY, char const* /*LPCTSTR*/, PHKEY );
    typedef LONG (WINAPI* RegCloseKeyT)( HKEY );

    info_t();

    IsDebuggerPresentT  m_is_debugger_present;
    RegOpenKeyT         m_reg_open_key;
    RegQueryValueExT    m_reg_query_value;
    RegCloseKeyT        m_reg_close_key;

} s_info;

//____________________________________________________________________________//

info_t::info_t()
{
    dyn_symbol( m_is_debugger_present, "kernel32", "IsDebuggerPresent" );
    dyn_symbol( m_reg_open_key, "advapi32", "RegOpenKeyA" );
    dyn_symbol( m_reg_query_value, "advapi32", "RegQueryValueExA" );
    dyn_symbol( m_reg_close_key, "advapi32", "RegCloseKey" );
}

//____________________________________________________________________________//

#elif defined(BOOST_UNIX_BASED_DEBUG)

// ************************************************************************** //
// **************                   fd_holder                  ************** //
// ************************************************************************** //

struct fd_holder {
    explicit fd_holder( int fd ) : m_fd( fd ) {}
    ~fd_holder()
    {
        if( m_fd != -1 )
            ::close( m_fd );
    }

    operator int() { return m_fd; }

private:
    // Data members
    int m_fd;
};

// ************************************************************************** //
// **************                 process_info                 ************** //
// ************************************************************************** //

struct process_info {
    // Constructor
    explicit        process_info( int pid );

    // access methods
    int             parent_pid() const  { return m_parent_pid; }
    const_string    binary_name() const { return m_binary_name; }
    const_string    binary_path() const { return m_binary_path; }

private:
    // Data members
    int             m_parent_pid;
    const_string    m_binary_name;
    const_string    m_binary_path;

#if defined(BOOST_SUN_BASED_DEBUG)
    struct psinfo   m_psi;
    char            m_binary_path_buff[500+1]; // !! ??
#elif defined(BOOST_LINUX_BASED_DEBUG)
    char            m_stat_line[BOOST_TEST_STAT_LINE_MAX+1];
    char            m_binary_path_buff[500+1]; // !! ??
#endif
};

//____________________________________________________________________________//

process_info::process_info( int pid )
: m_parent_pid( 0 )
{
#if defined(BOOST_SUN_BASED_DEBUG)
    char fname_buff[30];

    ::snprintf( fname_buff, sizeof(fname_buff), "/proc/%d/psinfo", pid );

    fd_holder psinfo_fd( ::open( fname_buff, O_RDONLY ) );

    if( psinfo_fd == -1 )
        return;

    if( ::read( psinfo_fd, &m_psi, sizeof(m_psi) ) == -1 )
        return;

    m_parent_pid = m_psi.pr_ppid;

    m_binary_name.assign( m_psi.pr_fname );

    //-------------------------- //

    ::snprintf( fname_buff, sizeof(fname_buff), "/proc/%d/as", pid );

    fd_holder as_fd( ::open( fname_buff, O_RDONLY ) );
    uintptr_t   binary_name_pos;

    // !! ?? could we avoid reading whole m_binary_path_buff?
    if( as_fd == -1 ||
        ::lseek( as_fd, m_psi.pr_argv, SEEK_SET ) == -1 ||
        ::read ( as_fd, &binary_name_pos, sizeof(binary_name_pos) ) == -1 ||
        ::lseek( as_fd, binary_name_pos, SEEK_SET ) == -1 ||
        ::read ( as_fd, m_binary_path_buff, sizeof(m_binary_path_buff) ) == -1 )
        return;

    m_binary_path.assign( m_binary_path_buff );

#elif defined(BOOST_LINUX_BASED_DEBUG)
    char fname_buff[30];

    ::snprintf( fname_buff, sizeof(fname_buff), "/proc/%d/stat", pid );

    fd_holder psinfo_fd( ::open( fname_buff, O_RDONLY ) );

    if( psinfo_fd == -1 )
        return;

    ssize_t num_read = ::read( psinfo_fd, m_stat_line, sizeof(m_stat_line)-1 );
    if( num_read == -1 )
        return;

    m_stat_line[num_read] = 0;

    char const* name_beg = m_stat_line;
    while( *name_beg && *name_beg != '(' )
        ++name_beg;

    char const* name_end = name_beg+1;
    while( *name_end && *name_end != ')' )
        ++name_end;

    std::sscanf( name_end+1, "%*s%d", &m_parent_pid );

    m_binary_name.assign( name_beg+1, name_end );

    ::snprintf( fname_buff, sizeof(fname_buff), "/proc/%d/exe", pid );
    num_read = ::readlink( fname_buff, m_binary_path_buff, sizeof(m_binary_path_buff)-1 );

    if( num_read == -1 )
        return;

    m_binary_path_buff[num_read] = 0;
    m_binary_path.assign( m_binary_path_buff, num_read );
#endif
}

//____________________________________________________________________________//

// ************************************************************************** //
// **************             prepare_window_title             ************** //
// ************************************************************************** //

static char*
prepare_window_title( dbg_startup_info const& dsi )
{
    typedef unit_test::const_string str_t;

    static char title_str[50];

    str_t path_sep( "\\/" );

    str_t::iterator  it = unit_test::utils::find_last_of( dsi.binary_path.begin(), dsi.binary_path.end(),
                                                          path_sep.begin(), path_sep.end() );

    if( it == dsi.binary_path.end() )
        it = dsi.binary_path.begin();
    else
        ++it;

    ::snprintf( title_str, sizeof(title_str), "%*s %ld", (int)(dsi.binary_path.end()-it), it, dsi.pid );

    return title_str;
}

//____________________________________________________________________________//

// ************************************************************************** //
// **************                  save_execlp                 ************** //
// ************************************************************************** //

typedef unit_test::basic_cstring<char> mbuffer;

inline char*
copy_arg( mbuffer& dest, const_string arg )
{
    if( dest.size() < arg.size()+1 )
        return 0;

    char* res = dest.begin();

    std::memcpy( res, arg.begin(), arg.size()+1 );

    dest.trim_left( arg.size()+1 );

    return res;
}

//____________________________________________________________________________//

bool
safe_execlp( char const* file, ... )
{
    static char* argv_buff[200];

    va_list     args;
    char const* arg;

    // first calculate actual number of arguments
    int         num_args = 2; // file name and 0 at least

    va_start( args, file );
    while( !!(arg = va_arg( args, char const* )) )
        num_args++;
    va_end( args );

    // reserve space for the argument pointers array
    char**      argv_it  = argv_buff;
    mbuffer     work_buff( reinterpret_cast<char*>(argv_buff), sizeof(argv_buff) );
    work_buff.trim_left( num_args * sizeof(char*) );

    // copy all the argument values into local storage
    if( !(*argv_it++ = copy_arg( work_buff, file )) )
        return false;

    printf( "!! %s\n", file );

    va_start( args, file );
    while( !!(arg = va_arg( args, char const* )) ) {
        printf( "!! %s\n", arg );
        if( !(*argv_it++ = copy_arg( work_buff, arg )) ) {
            va_end( args );
            return false;
        }
    }
    va_end( args );

    *argv_it = 0;

    return ::execvp( file, argv_buff ) != -1;
}

//____________________________________________________________________________//

// ************************************************************************** //
// **************            start_debugger_in_emacs           ************** //
// ************************************************************************** //

static void
start_debugger_in_emacs( dbg_startup_info const& dsi, char const* emacs_name, char const* dbg_command )
{
    char const* title = prepare_window_title( dsi );

    if( !title )
        return;

    dsi.display.is_empty()
        ? safe_execlp( emacs_name, "-title", title, "--eval", dbg_command, 0 )
        : safe_execlp( emacs_name, "-title", title, "-display", dsi.display.begin(), "--eval", dbg_command, 0 );
}

//____________________________________________________________________________//

// ************************************************************************** //
// **************                 gdb starters                 ************** //
// ************************************************************************** //

static char const*
prepare_gdb_cmnd_file( dbg_startup_info const& dsi )
{
    // prepare pid value
    char pid_buff[16];
    ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid );
    unit_test::const_string pid_str( pid_buff );

    static char cmd_file_name[] = "/tmp/btl_gdb_cmd_XXXXXX"; // !! ??

    // prepare commands
    fd_holder cmd_fd( ::mkstemp( cmd_file_name ) );

    if( cmd_fd == -1 )
        return 0;

#define WRITE_STR( str )  if( ::write( cmd_fd, str.begin(), str.size() ) == -1 ) return 0;
#define WRITE_CSTR( str ) if( ::write( cmd_fd, str, sizeof( str )-1 ) == -1 ) return 0;

    WRITE_CSTR( "file " );
    WRITE_STR( dsi.binary_path );
    WRITE_CSTR( "\nattach " );
    WRITE_STR( pid_str );
    WRITE_CSTR( "\nshell unlink " );
    WRITE_STR( dsi.init_done_lock );
    WRITE_CSTR( "\ncont" );
    if( dsi.break_or_continue )
        WRITE_CSTR( "\nup 4" );

    WRITE_CSTR( "\necho \\n" ); // !! ??
    WRITE_CSTR( "\nlist -" );
    WRITE_CSTR( "\nlist" );
    WRITE_CSTR( "\nshell unlink " );
    WRITE_CSTR( cmd_file_name );

    return cmd_file_name;
}

//____________________________________________________________________________//

static void
start_gdb_in_console( dbg_startup_info const& dsi )
{
    char const* cmnd_file_name = prepare_gdb_cmnd_file( dsi );

    if( !cmnd_file_name )
        return;

    safe_execlp( "gdb", "-q", "-x", cmnd_file_name, 0 );
}

//____________________________________________________________________________//

static void
start_gdb_in_xterm( dbg_startup_info const& dsi )
{
    char const* title           = prepare_window_title( dsi );
    char const* cmnd_file_name  = prepare_gdb_cmnd_file( dsi );

    if( !title || !cmnd_file_name )
        return;

    safe_execlp( "xterm", "-T", title, "-display", dsi.display.begin(),
                    "-bg", "black", "-fg", "white", "-geometry", "88x30+10+10", "-fn", "9x15", "-e",
                 "gdb", "-q", "-x", cmnd_file_name, 0 );
}

//____________________________________________________________________________//

static void
start_gdb_in_emacs( dbg_startup_info const& dsi )
{
    char const* cmnd_file_name  = prepare_gdb_cmnd_file( dsi );
    if( !cmnd_file_name )
        return;

    char dbg_cmd_buff[500]; // !! ??
    ::snprintf( dbg_cmd_buff, sizeof(dbg_cmd_buff), "(progn (gdb \"gdb -q -x %s\"))", cmnd_file_name );

    start_debugger_in_emacs( dsi, "emacs", dbg_cmd_buff );
}

//____________________________________________________________________________//

static void
start_gdb_in_xemacs( dbg_startup_info const& )
{
    // !! ??
}

//____________________________________________________________________________//

// ************************************************************************** //
// **************                 dbx starters                 ************** //
// ************************************************************************** //

static char const*
prepare_dbx_cmd_line( dbg_startup_info const& dsi, bool list_source = true )
{
    static char cmd_line_buff[500]; // !! ??

    ::snprintf( cmd_line_buff, sizeof(cmd_line_buff), "unlink %s;cont;%s%s",
                   dsi.init_done_lock.begin(),
                   dsi.break_or_continue ? "up 2;": "",
                   list_source ? "echo \" \";list -w3;" : "" );

    return cmd_line_buff;
}

//____________________________________________________________________________//

static void
start_dbx_in_console( dbg_startup_info const& dsi )
{
    char pid_buff[16];
    ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid );

    safe_execlp( "dbx", "-q", "-c", prepare_dbx_cmd_line( dsi ), dsi.binary_path.begin(), pid_buff, 0 );
}

//____________________________________________________________________________//

static void
start_dbx_in_xterm( dbg_startup_info const& dsi )
{
    char const* title = prepare_window_title( dsi );
    if( !title )
        return;

    char pid_buff[16]; // !! ??
    ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid );

    safe_execlp( "xterm", "-T", title, "-display", dsi.display.begin(),
                    "-bg", "black", "-fg", "white", "-geometry", "88x30+10+10", "-fn", "9x15", "-e",
                 "dbx", "-q", "-c", prepare_dbx_cmd_line( dsi ), dsi.binary_path.begin(), pid_buff, 0 );
}

//____________________________________________________________________________//

static void
start_dbx_in_emacs( dbg_startup_info const& /*dsi*/ )
{
//    char dbg_cmd_buff[500]; // !! ??
//
//    ::snprintf( dbg_cmd_buff, sizeof(dbg_cmd_buff), "(progn (dbx \"dbx -q -c cont %s %ld\"))", dsi.binary_path.begin(), dsi.pid );

//    start_debugger_in_emacs( dsi, "emacs", dbg_cmd_buff );
}

//____________________________________________________________________________//

static void
start_dbx_in_xemacs( dbg_startup_info const& )
{
    // !! ??
}

//____________________________________________________________________________//

static void
start_dbx_in_ddd( dbg_startup_info const& dsi )
{
    char const* title = prepare_window_title( dsi );
    if( !title )
        return;

    char pid_buff[16]; // !! ??
    ::snprintf( pid_buff, sizeof(pid_buff), "%ld", dsi.pid );

    safe_execlp( "ddd", "-display", dsi.display.begin(),
                 "--dbx", "-q", "-c", prepare_dbx_cmd_line( dsi, false ), dsi.binary_path.begin(), pid_buff, 0 );
}

//____________________________________________________________________________//

// ************************************************************************** //
// **************                debug::info_t                 ************** //
// ************************************************************************** //

static struct info_t {
    // Constructor
    info_t();

    // Public properties
    unit_test::readwrite_property<std::string>  p_dbg;

    // Data members
    std::map<std::string,dbg_starter>           m_dbg_starter_reg;
} s_info;

//____________________________________________________________________________//

info_t::info_t()
{
    p_dbg.value = ::getenv( "DISPLAY" )
        ? std::string( BOOST_STRINGIZE( BOOST_TEST_GUI_DBG ) )
        : std::string( BOOST_STRINGIZE( BOOST_TEST_CNL_DBG ) );

    m_dbg_starter_reg[std::string("gdb")]           = &start_gdb_in_console;
    m_dbg_starter_reg[std::string("gdb-emacs")]     = &start_gdb_in_emacs;
    m_dbg_starter_reg[std::string("gdb-xterm")]     = &start_gdb_in_xterm;
    m_dbg_starter_reg[std::string("gdb-xemacs")]    = &start_gdb_in_xemacs;

    m_dbg_starter_reg[std::string("dbx")]           = &start_dbx_in_console;
    m_dbg_starter_reg[std::string("dbx-emacs")]     = &start_dbx_in_emacs;
    m_dbg_starter_reg[std::string("dbx-xterm")]     = &start_dbx_in_xterm;
    m_dbg_starter_reg[std::string("dbx-xemacs")]    = &start_dbx_in_xemacs;
    m_dbg_starter_reg[std::string("dbx-ddd")]       = &start_dbx_in_ddd;
}

//____________________________________________________________________________//

#endif

} // local namespace

// ************************************************************************** //
// **************  check if program is running under debugger  ************** //
// ************************************************************************** //

bool
under_debugger()
{
#if defined(BOOST_WIN32_BASED_DEBUG) // *********************** WIN32

    return !!s_info.m_is_debugger_present && s_info.m_is_debugger_present();

#elif defined(BOOST_UNIX_BASED_DEBUG) // ********************** UNIX

    // !! ?? could/should we cache the result somehow?
    const_string    dbg_list = BOOST_TEST_STRINGIZE( BOOST_TEST_DBG_LIST );

    pid_t pid = ::getpid();

    while( pid != 0 ) {
        process_info pi( pid );

        // !! ?? should we use tokenizer here instead?
        if( dbg_list.find( pi.binary_name() ) != const_string::npos )
            return true;

        pid = (pi.parent_pid() == pid ? 0 : pi.parent_pid());
    }

    return false;

#else // ****************************************************** default

    return false;

#endif
}

//____________________________________________________________________________//

// ************************************************************************** //
// **************       cause program to break execution       ************** //
// **************           in debugger at call point          ************** //
// ************************************************************************** //

void
debugger_break()
{
    // !! ?? auto-start debugger?

#if defined(BOOST_WIN32_BASED_DEBUG) // *********************** WIN32

#if defined(__GNUC__) && !defined(__MINGW32__)   ||  \
    defined(__INTEL_COMPILER)
#   define BOOST_DEBUG_BREAK    __debugbreak
#else
#   define BOOST_DEBUG_BREAK    DebugBreak
#endif

#ifndef __MINGW32__
    if( !under_debugger() ) {
        __try {
            __try {
                BOOST_DEBUG_BREAK();
            }
            __except( UnhandledExceptionFilter(GetExceptionInformation()) )
            {
                // User opted to ignore the breakpoint
                return;
            }
        }
        __except (EXCEPTION_EXECUTE_HANDLER)
        {
            // If we got here, the user has pushed Debug. Debugger is already attached to our process and we
            // continue to let the another BOOST_DEBUG_BREAK to be called.
        }
    }
#endif

    BOOST_DEBUG_BREAK();

#elif defined(BOOST_UNIX_BASED_DEBUG) // ********************** UNIX

    ::kill( ::getpid(), SIGTRAP );

#else // ****************************************************** default

#endif
}

//____________________________________________________________________________//

// ************************************************************************** //
// **************            console debugger setup            ************** //
// ************************************************************************** //

#if defined(BOOST_UNIX_BASED_DEBUG) // ************************ UNIX

std::string
set_debugger( unit_test::const_string dbg_id, dbg_starter s )
{
    std::string old = s_info.p_dbg;

    assign_op( s_info.p_dbg.value, dbg_id, 0 );

    if( !!s )
        s_info.m_dbg_starter_reg[s_info.p_dbg.get()] = s;

    return old;
}

#else  // ***************************************************** default

std::string
set_debugger( unit_test::const_string, dbg_starter )
{
    return std::string();
}

#endif

//____________________________________________________________________________//

// ************************************************************************** //
// **************    attach debugger to the current process    ************** //
// ************************************************************************** //

#if defined(BOOST_WIN32_BASED_DEBUG)

struct safe_handle_helper
{
    HANDLE& handle;
    safe_handle_helper(HANDLE &handle_) : handle(handle_) {}

    void close_handle()
    {
        if( handle != INVALID_HANDLE_VALUE )
        {
            ::CloseHandle( handle );
            handle = INVALID_HANDLE_VALUE;
        }
    }

    ~safe_handle_helper()
    {
        close_handle();
    }
};
#endif

bool
attach_debugger( bool break_or_continue )
{
    if( under_debugger() )
        return false;

#if defined(BOOST_WIN32_BASED_DEBUG) // *********************** WIN32

    const int MAX_CMD_LINE = 200;

    // *************************************************** //
    // Debugger "ready" event

    SECURITY_ATTRIBUTES attr;
    attr.nLength                = sizeof(attr);
    attr.lpSecurityDescriptor   = NULL;
    attr.bInheritHandle         = true;

    // manual resettable, initially non signaled, unnamed event,
    // that will signal me that debugger initialization is done
    HANDLE dbg_init_done_ev = ::CreateEvent(
        &attr,          // pointer to security attributes
        true,           // flag for manual-reset event
        false,          // flag for initial state
        NULL            // pointer to event-object name
    );

    if( !dbg_init_done_ev )
        return false;

    safe_handle_helper safe_handle_obj( dbg_init_done_ev );

    // *************************************************** //
    // Debugger command line format

    HKEY reg_key;

    if( !s_info.m_reg_open_key || (*s_info.m_reg_open_key)(
            HKEY_LOCAL_MACHINE,                                         // handle of open key
            "Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug", // name of subkey to open
            &reg_key ) != ERROR_SUCCESS )                               // address of handle of open key
        return false;

    char  format[MAX_CMD_LINE];
    DWORD format_size = MAX_CMD_LINE;
    DWORD type = REG_SZ;

    bool b_read_key = s_info.m_reg_query_value &&
          ((*s_info.m_reg_query_value)(
            reg_key,                            // handle of open key
            "Debugger",                         // name of subkey to query
            0,                                  // reserved
            &type,                              // value type
            (LPBYTE)format,                     // buffer for returned string
            &format_size ) == ERROR_SUCCESS );  // in: buffer size; out: actual size of returned string

    if( !s_info.m_reg_close_key || (*s_info.m_reg_close_key)( reg_key ) != ERROR_SUCCESS )
        return false;

    if( !b_read_key )
        return false;

    // *************************************************** //
    // Debugger command line

    char cmd_line[MAX_CMD_LINE];
    std::sprintf( cmd_line, format, ::GetCurrentProcessId(), dbg_init_done_ev );

    // *************************************************** //
    // Debugger window parameters

    STARTUPINFOA    startup_info;
    std::memset( &startup_info, 0, sizeof(startup_info) );

    startup_info.cb             = sizeof(startup_info);
    startup_info.dwFlags        = STARTF_USESHOWWINDOW;
    startup_info.wShowWindow    = SW_SHOWNORMAL;

    // debugger process s_info
    PROCESS_INFORMATION debugger_info;

    bool created = !!::CreateProcessA(
        NULL,           // pointer to name of executable module; NULL - use the one in command line
        cmd_line,       // pointer to command line string
        NULL,           // pointer to process security attributes; NULL - debugger's handle can't be inherited
        NULL,           // pointer to thread security attributes; NULL - debugger's handle can't be inherited
        true,           // debugger inherit opened handles
        0,              // priority flags; 0 - normal priority
        NULL,           // pointer to new environment block; NULL - use this process environment
        NULL,           // pointer to current directory name; NULL - use this process correct directory
        &startup_info,  // pointer to STARTUPINFO that specifies main window appearance
        &debugger_info  // pointer to PROCESS_INFORMATION that will contain the new process identification
    );

    bool debugger_run_ok = false;
    if( created )
    {
        DWORD ret_code = ::WaitForSingleObject( dbg_init_done_ev, INFINITE );
        debugger_run_ok = ( ret_code == WAIT_OBJECT_0 );
    }

    safe_handle_obj.close_handle();

    if( !created || !debugger_run_ok )
        return false;

    if( break_or_continue )
        debugger_break();

    return true;

#elif defined(BOOST_UNIX_BASED_DEBUG) // ********************** UNIX

    char init_done_lock_fn[] = "/tmp/btl_dbg_init_done_XXXXXX";
    fd_holder init_done_lock_fd( ::mkstemp( init_done_lock_fn ) );

    if( init_done_lock_fd == -1 )
        return false;

    pid_t child_pid = fork();

    if( child_pid == -1 )
        return false;

    if( child_pid != 0 ) { // parent process - here we will start the debugger
        dbg_startup_info dsi;

        process_info pi( child_pid );
        if( pi.binary_path().is_empty() )
            ::exit( -1 );

        dsi.pid                 = child_pid;
        dsi.break_or_continue   = break_or_continue;
        dsi.binary_path         = pi.binary_path();
        dsi.display             = ::getenv( "DISPLAY" );
        dsi.init_done_lock      = init_done_lock_fn;

        dbg_starter starter = s_info.m_dbg_starter_reg[s_info.p_dbg];
        if( !!starter )
            starter( dsi );

        ::perror( "Boost.Test execution monitor failed to start a debugger:" );

        ::exit( -1 );
    }

    // child process - here we will continue our test module execution ; // !! ?? should it be vice versa

    while( ::access( init_done_lock_fn, F_OK ) == 0 ) {
        struct timeval to = { 0, 100 };

        ::select( 0, 0, 0, 0, &to );
    }

//    char dummy;
//    while( ::read( init_done_lock_fd, &dummy, sizeof(char) ) == 0 );

    if( break_or_continue )
        debugger_break();

    return true;

#else // ****************************************************** default

    return false;

#endif
}

//____________________________________________________________________________//

// ************************************************************************** //
// **************   switch on/off detect memory leaks feature  ************** //
// ************************************************************************** //

void
detect_memory_leaks( bool on_off, unit_test::const_string report_file )
{
    unit_test::ut_detail::ignore_unused_variable_warning( on_off );

#ifdef BOOST_MS_CRT_BASED_DEBUG
    int flags = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );

    if( !on_off )
        flags &= ~_CRTDBG_LEAK_CHECK_DF;
    else  {
        flags |= _CRTDBG_LEAK_CHECK_DF;
        _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);

        if( report_file.is_empty() )
            _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);
        else {
            HANDLE hreport_f = ::CreateFileA( report_file.begin(),
                                              GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
            _CrtSetReportFile(_CRT_WARN, hreport_f );
        }
    }

    _CrtSetDbgFlag ( flags );
#else
    unit_test::ut_detail::ignore_unused_variable_warning( report_file );
#endif // BOOST_MS_CRT_BASED_DEBUG
}

//____________________________________________________________________________//

// ************************************************************************** //
// **************      cause program to break execution in     ************** //
// **************     debugger at specific allocation point    ************** //
// ************************************************************************** //

void
break_memory_alloc( long mem_alloc_order_num )
{
    unit_test::ut_detail::ignore_unused_variable_warning( mem_alloc_order_num );

#ifdef BOOST_MS_CRT_BASED_DEBUG
    // only set the value if one was supplied (do not use default used by UTF just as a indicator to enable leak detection)
    if( mem_alloc_order_num > 1 )
        _CrtSetBreakAlloc( mem_alloc_order_num );
#endif // BOOST_MS_CRT_BASED_DEBUG
}

//____________________________________________________________________________//

} // namespace debug
} // namespace boost

#include <boost/test/detail/enable_warnings.hpp>

#endif // BOOST_TEST_DEBUG_API_IPP_112006GER


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)
==============================================================================*/
#if !defined(FUSION_PUSH_BACK_07162005_0235)
#define FUSION_PUSH_BACK_07162005_0235

#include <boost/fusion/support/config.hpp>
#include <boost/fusion/support/detail/as_fusion_element.hpp>
#include <boost/fusion/view/joint_view/joint_view.hpp>
#include <boost/fusion/view/single_view/single_view.hpp>
#include <boost/fusion/support/is_sequence.hpp>
#include <boost/utility/enable_if.hpp>

namespace boost { namespace fusion
{
    namespace result_of
    {
        template <typename Sequence, typename T>
        struct push_back
        {
            typedef fusion::single_view<typename detail::as_fusion_element<T>::type> single_view;
            typedef joint_view<Sequence, single_view const> type;
        };
    }

    template <typename Sequence, typename T>
    BOOST_CXX14_CONSTEXPR BOOST_FUSION_GPU_ENABLED
    inline typename
        lazy_enable_if<
            traits::is_sequence<Sequence>
          , result_of::push_back<Sequence const, T>
        >::type
    push_back(Sequence const& seq, T const& x)
    {
        typedef typename result_of::push_back<Sequence const, T> push_back;
        typedef typename push_back::single_view single_view;
        typedef typename push_back::type result;
        single_view x_(x);
        return result(seq, x_);
    }
}}

#endif


code:
//==============================================================================
//         Copyright 2003 - 2011  LASMEA UMR 6602 CNRS/Univ. Clermont II
//         Copyright 2009 - 2011  LRI    UMR 8623 CNRS/Univ Paris Sud XI
//         Copyright 2011         Eric Niebler
//
//          Distributed under the Boost Software License, Version 1.0.
//                 See accompanying file LICENSE.txt or copy at
//                     http://www.boost.org/LICENSE_1_0.txt
//==============================================================================
#ifndef BOOST_PROTO_PREPROCESSOR_REMOVE_TYPENAME_HPP_INCLUDED
#define BOOST_PROTO_PREPROCESSOR_REMOVE_TYPENAME_HPP_INCLUDED

/*!
 * \file
 * \brief Defines the BOOST_PROTO_REMOVE_TYPENAME macro
 */
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/expand.hpp>
#include <boost/preprocessor/tuple/eat.hpp>
#include <boost/preprocessor/control/iif.hpp>
#include <boost/preprocessor/detail/is_unary.hpp>

//==============================================================================
// Boost.Preprocessor author P. Mensodines confirmed on an Boost email thread
// (subject ``check if a token is a keyword (was "BOOST_PP_IS_UNARY()")'')
// that it is OK to used `PP_IS_UNARY()` to check if tokens match predefined
// "keyword" as it is done by the macros below (even if `PP_IS_UNARY()` is
// technically only part of Boost.Preprocessor private API).
//==============================================================================

//==============================================================================
// `checking_prefix ## tokens` expand to unary (e.g., `(1)`) iff `tokens` start
// with keyword to check.
//==============================================================================
#define BOOST_PROTO_DETAILS_KEYWORD_FACILITY_IS_FRONT(T, CHECKING_PREFIX)                           \
    BOOST_PP_IS_UNARY(BOOST_PP_CAT(CHECKING_PREFIX, T))                                             \
    /**/

//==============================================================================
// `is_front_macro(tokens)` is 1 iff `tokens` start with keyword to remove.
// `removing_prefix ## <keyword-to-remove>` must expand to nothing.
//==============================================================================
#define BOOST_PROTO_DETAILS_KEYWORD_FACILITY_REMOVE_FRONT(TOKENS, IS_FRONT_MACRO, REMOVING_PREFIX)  \
    BOOST_PP_EXPAND( /* without EXPAND doesn't expand on MSVC */                                    \
        BOOST_PP_IIF(                                                                               \
            IS_FRONT_MACRO(TOKENS)                                                                  \
          , BOOST_PP_CAT                                                                            \
          , TOKENS BOOST_PP_TUPLE_EAT(2)                                                            \
        )(REMOVING_PREFIX, TOKENS)                                                                  \
    )                                                                                \
    /**/

#define BOOST_PROTO_DETAILS_KEYWORD_TYPENAME_IS_typename (1) /* unary */
#define typename_BOOST_PROTO_DETAILS_KEYWORD_TYPENAME_IS (1) /* unary */
#define BOOST_PROTO_DETAILS_KEYWORD_TYPENAME_REMOVE_typename /* nothing */
#define typename_BOOST_PROTO_DETAILS_KEYWORD_TYPENAME_REMOVE /* nothing */

#define BOOST_PROTO_DETAILS_KEYWORD_IS_TYPENAME_FRONT(TOKENS)                                       \
    BOOST_PROTO_DETAILS_KEYWORD_FACILITY_IS_FRONT(TOKENS, BOOST_PROTO_DETAILS_KEYWORD_TYPENAME_IS_) \
    /**/

//==============================================================================
/*!
 * \ingroup preprocessor
 * For any symbol \c X, this macro returns the same symbol from which a potential
 * leading \c typename keyword has been removed. If no typename keyword is present,
 * this macros evaluates to \c X itself without error.
 *
 * The original implementation of this macro is from Lorenzo Caminiti.
 *
 * \param X Symbol to remove \c typename from
 */
//==============================================================================
#define BOOST_PROTO_REMOVE_TYPENAME(X)                                                              \
    BOOST_PROTO_DETAILS_KEYWORD_FACILITY_REMOVE_FRONT(                                              \
        X                                                                                \
      , BOOST_PROTO_DETAILS_KEYWORD_IS_TYPENAME_FRONT                                               \
      , BOOST_PROTO_DETAILS_KEYWORD_TYPENAME_REMOVE_                                                \
    )                                                                                \
    /**/

#endif