Initial Commit

This commit is contained in:
Jordan Sherer
2018-02-08 21:28:33 -05:00
commit 678c1d3966
14352 changed files with 3176737 additions and 0 deletions
@@ -0,0 +1,295 @@
// (C) Copyright John Maddock 2006-8.
// 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_MATH_NTL_DIGAMMA
#define BOOST_MATH_NTL_DIGAMMA
#include <boost/math/tools/rational.hpp>
#include <boost/math/policies/error_handling.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/lexical_cast.hpp>
namespace boost{ namespace math{ namespace detail{
template <class T>
T big_digamma_helper(T x)
{
static const T P[61] = {
boost::lexical_cast<T>("0.6660133691143982067148122682345055274952e81"),
boost::lexical_cast<T>("0.6365271516829242456324234577164675383137e81"),
boost::lexical_cast<T>("0.2991038873096202943405966144203628966976e81"),
boost::lexical_cast<T>("0.9211116495503170498076013367421231351115e80"),
boost::lexical_cast<T>("0.2090792764676090716286400360584443891749e80"),
boost::lexical_cast<T>("0.3730037777359591428226035156377978092809e79"),
boost::lexical_cast<T>("0.5446396536956682043376492370432031543834e78"),
boost::lexical_cast<T>("0.6692523966335177847425047827449069256345e77"),
boost::lexical_cast<T>("0.7062543624100864681625612653756619116848e76"),
boost::lexical_cast<T>("0.6499914905966283735005256964443226879158e75"),
boost::lexical_cast<T>("0.5280364564853225211197557708655426736091e74"),
boost::lexical_cast<T>("0.3823205608981176913075543599005095206953e73"),
boost::lexical_cast<T>("0.2486733714214237704739129972671154532415e72"),
boost::lexical_cast<T>("0.1462562139602039577983434547171318011675e71"),
boost::lexical_cast<T>("0.7821169065036815012381267259559910324285e69"),
boost::lexical_cast<T>("0.3820552182348155468636157988764435365078e68"),
boost::lexical_cast<T>("0.1711618296983598244658239925535632505062e67"),
boost::lexical_cast<T>("0.7056661618357643731419080738521475204245e65"),
boost::lexical_cast<T>("0.2685246896473614017356264531791459936036e64"),
boost::lexical_cast<T>("0.9455168125599643085283071944864977592391e62"),
boost::lexical_cast<T>("0.3087541626972538362237309145177486236219e61"),
boost::lexical_cast<T>("0.9367928873352980208052601301625005737407e59"),
boost::lexical_cast<T>("0.2645306130689794942883818547314327466007e58"),
boost::lexical_cast<T>("0.6961815141171454309161007351079576190079e56"),
boost::lexical_cast<T>("0.1709637824471794552313802669803885946843e55"),
boost::lexical_cast<T>("0.3921553258481531526663112728778759311158e53"),
boost::lexical_cast<T>("0.8409006354449988687714450897575728228696e51"),
boost::lexical_cast<T>("0.1686755204461325935742097669030363344927e50"),
boost::lexical_cast<T>("0.3166653542877070999007425197729038754254e48"),
boost::lexical_cast<T>("0.5566029092358215049069560272835654229637e46"),
boost::lexical_cast<T>("0.9161766287916328133080586672953875116242e44"),
boost::lexical_cast<T>("1412317772330871298317974693514430627922000"),
boost::lexical_cast<T>("20387991986727877473732570146112459874790"),
boost::lexical_cast<T>("275557928713904105182512535678580359839.3"),
boost::lexical_cast<T>("3485719851040516559072031256589598330.723"),
boost::lexical_cast<T>("41247046743564028399938106707656877.40859"),
boost::lexical_cast<T>("456274078125709314602601667471879.0147312"),
boost::lexical_cast<T>("4714450683242899367025707077155.310613012"),
boost::lexical_cast<T>("45453933537925041680009544258.75073849996"),
boost::lexical_cast<T>("408437900487067278846361972.302331241052"),
boost::lexical_cast<T>("3415719344386166273085838.705771571751035"),
boost::lexical_cast<T>("26541502879185876562320.93134691487351145"),
boost::lexical_cast<T>("191261415065918713661.1571433274648417668"),
boost::lexical_cast<T>("1275349770108718421.645275944284937551702"),
boost::lexical_cast<T>("7849171120971773.318910987434906905704272"),
boost::lexical_cast<T>("44455946386549.80866460312682983576538056"),
boost::lexical_cast<T>("230920362395.3198137186361608905136598046"),
boost::lexical_cast<T>("1095700096.240863858624279930600654130254"),
boost::lexical_cast<T>("4727085.467506050153744334085516289728134"),
boost::lexical_cast<T>("18440.75118859447173303252421991479005424"),
boost::lexical_cast<T>("64.62515887799460295677071749181651317052"),
boost::lexical_cast<T>("0.201851568864688406206528472883512147547"),
boost::lexical_cast<T>("0.0005565091674187978029138500039504078098143"),
boost::lexical_cast<T>("0.1338097668312907986354698683493366559613e-5"),
boost::lexical_cast<T>("0.276308225077464312820179030238305271638e-8"),
boost::lexical_cast<T>("0.4801582970473168520375942100071070575043e-11"),
boost::lexical_cast<T>("0.6829184144212920949740376186058541800175e-14"),
boost::lexical_cast<T>("0.7634080076358511276617829524639455399182e-17"),
boost::lexical_cast<T>("0.6290035083727140966418512608156646142409e-20"),
boost::lexical_cast<T>("0.339652245667538733044036638506893821352e-23"),
boost::lexical_cast<T>("0.9017518064256388530773585529891677854909e-27")
};
static const T Q[61] = {
boost::lexical_cast<T>("0"),
boost::lexical_cast<T>("0.1386831185456898357379390197203894063459e81"),
boost::lexical_cast<T>("0.6467076379487574703291056110838151259438e81"),
boost::lexical_cast<T>("0.1394967823848615838336194279565285465161e82"),
boost::lexical_cast<T>("0.1872927317344192945218570366455046340458e82"),
boost::lexical_cast<T>("0.1772461045338946243584650759986310355937e82"),
boost::lexical_cast<T>("0.1267294892200258648315971144069595555118e82"),
boost::lexical_cast<T>("0.7157764838362416821508872117623058626589e81"),
boost::lexical_cast<T>("0.329447266909948668265277828268378274513e81"),
boost::lexical_cast<T>("0.1264376077317689779509250183194342571207e81"),
boost::lexical_cast<T>("0.4118230304191980787640446056583623228873e80"),
boost::lexical_cast<T>("0.1154393529762694616405952270558316515261e80"),
boost::lexical_cast<T>("0.281655612889423906125295485693696744275e79"),
boost::lexical_cast<T>("0.6037483524928743102724159846414025482077e78"),
boost::lexical_cast<T>("0.1145927995397835468123576831800276999614e78"),
boost::lexical_cast<T>("0.1938624296151985600348534009382865995154e77"),
boost::lexical_cast<T>("0.293980925856227626211879961219188406675e76"),
boost::lexical_cast<T>("0.4015574518216966910319562902099567437832e75"),
boost::lexical_cast<T>("0.4961475457509727343545565970423431880907e74"),
boost::lexical_cast<T>("0.5565482348278933960215521991000378896338e73"),
boost::lexical_cast<T>("0.5686112924615820754631098622770303094938e72"),
boost::lexical_cast<T>("0.5305988545844796293285410303747469932856e71"),
boost::lexical_cast<T>("0.4533363413802585060568537458067343491358e70"),
boost::lexical_cast<T>("0.3553932059473516064068322757331575565718e69"),
boost::lexical_cast<T>("0.2561198565218704414618802902533972354203e68"),
boost::lexical_cast<T>("0.1699519313292900324098102065697454295572e67"),
boost::lexical_cast<T>("0.1039830160862334505389615281373574959236e66"),
boost::lexical_cast<T>("0.5873082967977428281000961954715372504986e64"),
boost::lexical_cast<T>("0.3065255179030575882202133042549783442446e63"),
boost::lexical_cast<T>("0.1479494813481364701208655943688307245459e62"),
boost::lexical_cast<T>("0.6608150467921598615495180659808895663164e60"),
boost::lexical_cast<T>("0.2732535313770902021791888953487787496976e59"),
boost::lexical_cast<T>("0.1046402297662493314531194338414508049069e58"),
boost::lexical_cast<T>("0.3711375077192882936085049147920021549622e56"),
boost::lexical_cast<T>("0.1219154482883895482637944309702972234576e55"),
boost::lexical_cast<T>("0.3708359374149458741391374452286837880162e53"),
boost::lexical_cast<T>("0.1044095509971707189716913168889769471468e52"),
boost::lexical_cast<T>("0.271951506225063286130946773813524945052e50"),
boost::lexical_cast<T>("0.6548016291215163843464133978454065823866e48"),
boost::lexical_cast<T>("0.1456062447610542135403751730809295219344e47"),
boost::lexical_cast<T>("0.2986690175077969760978388356833006028929e45"),
boost::lexical_cast<T>("5643149706574013350061247429006443326844000"),
boost::lexical_cast<T>("98047545414467090421964387960743688053480"),
boost::lexical_cast<T>("1563378767746846395507385099301468978550"),
boost::lexical_cast<T>("22823360528584500077862274918382796495"),
boost::lexical_cast<T>("304215527004115213046601295970388750"),
boost::lexical_cast<T>("3690289075895685793844344966820325"),
boost::lexical_cast<T>("40584512015702371433911456606050"),
boost::lexical_cast<T>("402834190897282802772754873905"),
boost::lexical_cast<T>("3589522158493606918146495750"),
boost::lexical_cast<T>("28530557707503483723634725"),
boost::lexical_cast<T>("200714561335055753000730"),
boost::lexical_cast<T>("1237953783437761888641"),
boost::lexical_cast<T>("6614698701445762950"),
boost::lexical_cast<T>("30155495647727505"),
boost::lexical_cast<T>("114953256021450"),
boost::lexical_cast<T>("356398020013"),
boost::lexical_cast<T>("863113950"),
boost::lexical_cast<T>("1531345"),
boost::lexical_cast<T>("1770"),
boost::lexical_cast<T>("1")
};
static const T PD[60] = {
boost::lexical_cast<T>("0.6365271516829242456324234577164675383137e81"),
2*boost::lexical_cast<T>("0.2991038873096202943405966144203628966976e81"),
3*boost::lexical_cast<T>("0.9211116495503170498076013367421231351115e80"),
4*boost::lexical_cast<T>("0.2090792764676090716286400360584443891749e80"),
5*boost::lexical_cast<T>("0.3730037777359591428226035156377978092809e79"),
6*boost::lexical_cast<T>("0.5446396536956682043376492370432031543834e78"),
7*boost::lexical_cast<T>("0.6692523966335177847425047827449069256345e77"),
8*boost::lexical_cast<T>("0.7062543624100864681625612653756619116848e76"),
9*boost::lexical_cast<T>("0.6499914905966283735005256964443226879158e75"),
10*boost::lexical_cast<T>("0.5280364564853225211197557708655426736091e74"),
11*boost::lexical_cast<T>("0.3823205608981176913075543599005095206953e73"),
12*boost::lexical_cast<T>("0.2486733714214237704739129972671154532415e72"),
13*boost::lexical_cast<T>("0.1462562139602039577983434547171318011675e71"),
14*boost::lexical_cast<T>("0.7821169065036815012381267259559910324285e69"),
15*boost::lexical_cast<T>("0.3820552182348155468636157988764435365078e68"),
16*boost::lexical_cast<T>("0.1711618296983598244658239925535632505062e67"),
17*boost::lexical_cast<T>("0.7056661618357643731419080738521475204245e65"),
18*boost::lexical_cast<T>("0.2685246896473614017356264531791459936036e64"),
19*boost::lexical_cast<T>("0.9455168125599643085283071944864977592391e62"),
20*boost::lexical_cast<T>("0.3087541626972538362237309145177486236219e61"),
21*boost::lexical_cast<T>("0.9367928873352980208052601301625005737407e59"),
22*boost::lexical_cast<T>("0.2645306130689794942883818547314327466007e58"),
23*boost::lexical_cast<T>("0.6961815141171454309161007351079576190079e56"),
24*boost::lexical_cast<T>("0.1709637824471794552313802669803885946843e55"),
25*boost::lexical_cast<T>("0.3921553258481531526663112728778759311158e53"),
26*boost::lexical_cast<T>("0.8409006354449988687714450897575728228696e51"),
27*boost::lexical_cast<T>("0.1686755204461325935742097669030363344927e50"),
28*boost::lexical_cast<T>("0.3166653542877070999007425197729038754254e48"),
29*boost::lexical_cast<T>("0.5566029092358215049069560272835654229637e46"),
30*boost::lexical_cast<T>("0.9161766287916328133080586672953875116242e44"),
31*boost::lexical_cast<T>("1412317772330871298317974693514430627922000"),
32*boost::lexical_cast<T>("20387991986727877473732570146112459874790"),
33*boost::lexical_cast<T>("275557928713904105182512535678580359839.3"),
34*boost::lexical_cast<T>("3485719851040516559072031256589598330.723"),
35*boost::lexical_cast<T>("41247046743564028399938106707656877.40859"),
36*boost::lexical_cast<T>("456274078125709314602601667471879.0147312"),
37*boost::lexical_cast<T>("4714450683242899367025707077155.310613012"),
38*boost::lexical_cast<T>("45453933537925041680009544258.75073849996"),
39*boost::lexical_cast<T>("408437900487067278846361972.302331241052"),
40*boost::lexical_cast<T>("3415719344386166273085838.705771571751035"),
41*boost::lexical_cast<T>("26541502879185876562320.93134691487351145"),
42*boost::lexical_cast<T>("191261415065918713661.1571433274648417668"),
43*boost::lexical_cast<T>("1275349770108718421.645275944284937551702"),
44*boost::lexical_cast<T>("7849171120971773.318910987434906905704272"),
45*boost::lexical_cast<T>("44455946386549.80866460312682983576538056"),
46*boost::lexical_cast<T>("230920362395.3198137186361608905136598046"),
47*boost::lexical_cast<T>("1095700096.240863858624279930600654130254"),
48*boost::lexical_cast<T>("4727085.467506050153744334085516289728134"),
49*boost::lexical_cast<T>("18440.75118859447173303252421991479005424"),
50*boost::lexical_cast<T>("64.62515887799460295677071749181651317052"),
51*boost::lexical_cast<T>("0.201851568864688406206528472883512147547"),
52*boost::lexical_cast<T>("0.0005565091674187978029138500039504078098143"),
53*boost::lexical_cast<T>("0.1338097668312907986354698683493366559613e-5"),
54*boost::lexical_cast<T>("0.276308225077464312820179030238305271638e-8"),
55*boost::lexical_cast<T>("0.4801582970473168520375942100071070575043e-11"),
56*boost::lexical_cast<T>("0.6829184144212920949740376186058541800175e-14"),
57*boost::lexical_cast<T>("0.7634080076358511276617829524639455399182e-17"),
58*boost::lexical_cast<T>("0.6290035083727140966418512608156646142409e-20"),
59*boost::lexical_cast<T>("0.339652245667538733044036638506893821352e-23"),
60*boost::lexical_cast<T>("0.9017518064256388530773585529891677854909e-27")
};
static const T QD[60] = {
boost::lexical_cast<T>("0.1386831185456898357379390197203894063459e81"),
2*boost::lexical_cast<T>("0.6467076379487574703291056110838151259438e81"),
3*boost::lexical_cast<T>("0.1394967823848615838336194279565285465161e82"),
4*boost::lexical_cast<T>("0.1872927317344192945218570366455046340458e82"),
5*boost::lexical_cast<T>("0.1772461045338946243584650759986310355937e82"),
6*boost::lexical_cast<T>("0.1267294892200258648315971144069595555118e82"),
7*boost::lexical_cast<T>("0.7157764838362416821508872117623058626589e81"),
8*boost::lexical_cast<T>("0.329447266909948668265277828268378274513e81"),
9*boost::lexical_cast<T>("0.1264376077317689779509250183194342571207e81"),
10*boost::lexical_cast<T>("0.4118230304191980787640446056583623228873e80"),
11*boost::lexical_cast<T>("0.1154393529762694616405952270558316515261e80"),
12*boost::lexical_cast<T>("0.281655612889423906125295485693696744275e79"),
13*boost::lexical_cast<T>("0.6037483524928743102724159846414025482077e78"),
14*boost::lexical_cast<T>("0.1145927995397835468123576831800276999614e78"),
15*boost::lexical_cast<T>("0.1938624296151985600348534009382865995154e77"),
16*boost::lexical_cast<T>("0.293980925856227626211879961219188406675e76"),
17*boost::lexical_cast<T>("0.4015574518216966910319562902099567437832e75"),
18*boost::lexical_cast<T>("0.4961475457509727343545565970423431880907e74"),
19*boost::lexical_cast<T>("0.5565482348278933960215521991000378896338e73"),
20*boost::lexical_cast<T>("0.5686112924615820754631098622770303094938e72"),
21*boost::lexical_cast<T>("0.5305988545844796293285410303747469932856e71"),
22*boost::lexical_cast<T>("0.4533363413802585060568537458067343491358e70"),
23*boost::lexical_cast<T>("0.3553932059473516064068322757331575565718e69"),
24*boost::lexical_cast<T>("0.2561198565218704414618802902533972354203e68"),
25*boost::lexical_cast<T>("0.1699519313292900324098102065697454295572e67"),
26*boost::lexical_cast<T>("0.1039830160862334505389615281373574959236e66"),
27*boost::lexical_cast<T>("0.5873082967977428281000961954715372504986e64"),
28*boost::lexical_cast<T>("0.3065255179030575882202133042549783442446e63"),
29*boost::lexical_cast<T>("0.1479494813481364701208655943688307245459e62"),
30*boost::lexical_cast<T>("0.6608150467921598615495180659808895663164e60"),
31*boost::lexical_cast<T>("0.2732535313770902021791888953487787496976e59"),
32*boost::lexical_cast<T>("0.1046402297662493314531194338414508049069e58"),
33*boost::lexical_cast<T>("0.3711375077192882936085049147920021549622e56"),
34*boost::lexical_cast<T>("0.1219154482883895482637944309702972234576e55"),
35*boost::lexical_cast<T>("0.3708359374149458741391374452286837880162e53"),
36*boost::lexical_cast<T>("0.1044095509971707189716913168889769471468e52"),
37*boost::lexical_cast<T>("0.271951506225063286130946773813524945052e50"),
38*boost::lexical_cast<T>("0.6548016291215163843464133978454065823866e48"),
39*boost::lexical_cast<T>("0.1456062447610542135403751730809295219344e47"),
40*boost::lexical_cast<T>("0.2986690175077969760978388356833006028929e45"),
41*boost::lexical_cast<T>("5643149706574013350061247429006443326844000"),
42*boost::lexical_cast<T>("98047545414467090421964387960743688053480"),
43*boost::lexical_cast<T>("1563378767746846395507385099301468978550"),
44*boost::lexical_cast<T>("22823360528584500077862274918382796495"),
45*boost::lexical_cast<T>("304215527004115213046601295970388750"),
46*boost::lexical_cast<T>("3690289075895685793844344966820325"),
47*boost::lexical_cast<T>("40584512015702371433911456606050"),
48*boost::lexical_cast<T>("402834190897282802772754873905"),
49*boost::lexical_cast<T>("3589522158493606918146495750"),
50*boost::lexical_cast<T>("28530557707503483723634725"),
51*boost::lexical_cast<T>("200714561335055753000730"),
52*boost::lexical_cast<T>("1237953783437761888641"),
53*boost::lexical_cast<T>("6614698701445762950"),
54*boost::lexical_cast<T>("30155495647727505"),
55*boost::lexical_cast<T>("114953256021450"),
56*boost::lexical_cast<T>("356398020013"),
57*boost::lexical_cast<T>("863113950"),
58*boost::lexical_cast<T>("1531345"),
59*boost::lexical_cast<T>("1770"),
60*boost::lexical_cast<T>("1")
};
static const double g = 63.192152;
T zgh = x + g - 0.5;
T result = (x - 0.5) / zgh;
result += log(zgh);
result += tools::evaluate_polynomial(PD, x) / tools::evaluate_polynomial(P, x);
result -= tools::evaluate_polynomial(QD, x) / tools::evaluate_polynomial(Q, x);
result -= 1;
return result;
}
template <class T>
T big_digamma(T x)
{
BOOST_MATH_STD_USING
if(x < 0)
{
return big_digamma_helper(static_cast<T>(1-x)) + constants::pi<T>() / tan(constants::pi<T>() * (1-x));
}
return big_digamma_helper(x);
}
}}}
#endif // include guard
@@ -0,0 +1,81 @@
/*=============================================================================
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_HAS_KEY_09232005_1454)
#define FUSION_HAS_KEY_09232005_1454
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/sequence/intrinsic_fwd.hpp>
#include <boost/fusion/support/tag_of.hpp>
#include <boost/fusion/iterator/equal_to.hpp>
#include <boost/fusion/algorithm/query/find.hpp>
#include <boost/fusion/sequence/intrinsic/end.hpp>
#include <boost/mpl/not.hpp>
namespace boost { namespace fusion
{
struct void_;
// Special tags:
struct sequence_facade_tag;
struct boost_array_tag; // boost::array tag
struct mpl_sequence_tag; // mpl sequence tag
struct std_pair_tag; // std::pair tag
namespace extension
{
template <typename Tag>
struct has_key_impl
{
template <typename Seq, typename Key>
struct apply
: mpl::not_<
typename result_of::equal_to<
typename result_of::find<Seq, Key>::type
, typename result_of::end<Seq>::type
>::type
>::type
{};
};
template <>
struct has_key_impl<sequence_facade_tag>
{
template <typename Sequence, typename Key>
struct apply : Sequence::template has_key<Sequence, Key> {};
};
template <>
struct has_key_impl<boost_array_tag>;
template <>
struct has_key_impl<mpl_sequence_tag>;
template <>
struct has_key_impl<std_pair_tag>;
}
namespace result_of
{
template <typename Sequence, typename Key>
struct has_key
: extension::has_key_impl<typename detail::tag_of<Sequence>::type>::
template apply<Sequence, Key>
{};
}
template <typename Key, typename Sequence>
BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED
inline typename result_of::has_key<Sequence, Key>::type
has_key(Sequence const&)
{
typedef typename result_of::has_key<Sequence, Key>::type result;
return result();
}
}}
#endif
@@ -0,0 +1,131 @@
//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
//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 UUID_1A590226753311DD9E4CCF6156D89593
#define UUID_1A590226753311DD9E4CCF6156D89593
#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma GCC system_header
#endif
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(push,1)
#endif
#include <boost/exception/exception.hpp>
#include <boost/exception/detail/error_info_impl.hpp>
#include <boost/exception/detail/type_info.hpp>
#include <boost/exception/detail/shared_ptr.hpp>
#include <boost/assert.hpp>
namespace
boost
{
namespace
exception_detail
{
template <class ErrorInfo>
struct
get_info
{
static
typename ErrorInfo::value_type *
get( exception const & x )
{
if( exception_detail::error_info_container * c=x.data_.get() )
if( shared_ptr<exception_detail::error_info_base> eib = c->get(BOOST_EXCEPTION_STATIC_TYPEID(ErrorInfo)) )
{
#ifndef BOOST_NO_RTTI
BOOST_ASSERT( 0!=dynamic_cast<ErrorInfo *>(eib.get()) );
#endif
ErrorInfo * w = static_cast<ErrorInfo *>(eib.get());
return &w->value();
}
return 0;
}
};
template <>
struct
get_info<throw_function>
{
static
char const * *
get( exception const & x )
{
return x.throw_function_ ? &x.throw_function_ : 0;
}
};
template <>
struct
get_info<throw_file>
{
static
char const * *
get( exception const & x )
{
return x.throw_file_ ? &x.throw_file_ : 0;
}
};
template <>
struct
get_info<throw_line>
{
static
int *
get( exception const & x )
{
return x.throw_line_!=-1 ? &x.throw_line_ : 0;
}
};
template <class T,class R>
struct
get_error_info_return_type
{
typedef R * type;
};
template <class T,class R>
struct
get_error_info_return_type<T const,R>
{
typedef R const * type;
};
}
#ifdef BOOST_NO_RTTI
template <class ErrorInfo>
inline
typename ErrorInfo::value_type const *
get_error_info( boost::exception const & x )
{
return exception_detail::get_info<ErrorInfo>::get(x);
}
template <class ErrorInfo>
inline
typename ErrorInfo::value_type *
get_error_info( boost::exception & x )
{
return exception_detail::get_info<ErrorInfo>::get(x);
}
#else
template <class ErrorInfo,class E>
inline
typename exception_detail::get_error_info_return_type<E,typename ErrorInfo::value_type>::type
get_error_info( E & some_exception )
{
if( exception const * x = dynamic_cast<exception const *>(&some_exception) )
return exception_detail::get_info<ErrorInfo>::get(*x);
else
return 0;
}
#endif
}
#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS)
#pragma warning(pop)
#endif
#endif
@@ -0,0 +1,333 @@
/*
*
* Copyright (c) 2003
* John Maddock
*
* 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)
*
*/
/*
* LOCATION: see http://www.boost.org for most recent version.
* FILE regex_token_iterator.hpp
* VERSION see <boost/version.hpp>
* DESCRIPTION: Provides regex_token_iterator implementation.
*/
#ifndef BOOST_REGEX_V4_REGEX_TOKEN_ITERATOR_HPP
#define BOOST_REGEX_V4_REGEX_TOKEN_ITERATOR_HPP
#include <boost/shared_ptr.hpp>
#include <boost/detail/workaround.hpp>
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003))
//
// Borland C++ Builder 6, and Visual C++ 6,
// can't cope with the array template constructor
// so we have a template member that will accept any type as
// argument, and then assert that is really is an array:
//
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_array.hpp>
#endif
namespace boost{
#ifdef BOOST_MSVC
#pragma warning(push)
#pragma warning(disable: 4103)
#endif
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
#endif
#ifdef BOOST_MSVC
#pragma warning(pop)
#pragma warning(push)
#pragma warning(disable:4700)
#endif
template <class BidirectionalIterator,
class charT,
class traits>
class regex_token_iterator_implementation
{
typedef basic_regex<charT, traits> regex_type;
typedef sub_match<BidirectionalIterator> value_type;
match_results<BidirectionalIterator> what; // current match
BidirectionalIterator base; // start of search area
BidirectionalIterator end; // end of search area
const regex_type re; // the expression
match_flag_type flags; // match flags
value_type result; // the current string result
int N; // the current sub-expression being enumerated
std::vector<int> subs; // the sub-expressions to enumerate
public:
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, int sub, match_flag_type f)
: end(last), re(*p), flags(f){ subs.push_back(sub); }
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const std::vector<int>& v, match_flag_type f)
: end(last), re(*p), flags(f), subs(v){}
#if !BOOST_WORKAROUND(__HP_aCC, < 60700)
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \
|| BOOST_WORKAROUND(__HP_aCC, < 60700)
template <class T>
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const T& submatches, match_flag_type f)
: end(last), re(*p), flags(f)
{
// assert that T really is an array:
BOOST_STATIC_ASSERT(::boost::is_array<T>::value);
const std::size_t array_size = sizeof(T) / sizeof(submatches[0]);
for(std::size_t i = 0; i < array_size; ++i)
{
subs.push_back(submatches[i]);
}
}
#else
template <std::size_t CN>
regex_token_iterator_implementation(const regex_type* p, BidirectionalIterator last, const int (&submatches)[CN], match_flag_type f)
: end(last), re(*p), flags(f)
{
for(std::size_t i = 0; i < CN; ++i)
{
subs.push_back(submatches[i]);
}
}
#endif
#endif
bool init(BidirectionalIterator first)
{
N = 0;
base = first;
if(regex_search(first, end, what, re, flags, base) == true)
{
N = 0;
result = ((subs[N] == -1) ? what.prefix() : what[(int)subs[N]]);
return true;
}
else if((subs[N] == -1) && (first != end))
{
result.first = first;
result.second = end;
result.matched = (first != end);
N = -1;
return true;
}
return false;
}
bool compare(const regex_token_iterator_implementation& that)
{
if(this == &that) return true;
return (&re.get_data() == &that.re.get_data())
&& (end == that.end)
&& (flags == that.flags)
&& (N == that.N)
&& (what[0].first == that.what[0].first)
&& (what[0].second == that.what[0].second);
}
const value_type& get()
{ return result; }
bool next()
{
if(N == -1)
return false;
if(N+1 < (int)subs.size())
{
++N;
result =((subs[N] == -1) ? what.prefix() : what[subs[N]]);
return true;
}
//if(what.prefix().first != what[0].second)
// flags |= /*match_prev_avail |*/ regex_constants::match_not_bob;
BidirectionalIterator last_end(what[0].second);
if(regex_search(last_end, end, what, re, ((what[0].first == what[0].second) ? flags | regex_constants::match_not_initial_null : flags), base))
{
N =0;
result =((subs[N] == -1) ? what.prefix() : what[subs[N]]);
return true;
}
else if((last_end != end) && (subs[0] == -1))
{
N =-1;
result.first = last_end;
result.second = end;
result.matched = (last_end != end);
return true;
}
return false;
}
private:
regex_token_iterator_implementation& operator=(const regex_token_iterator_implementation&);
};
template <class BidirectionalIterator,
class charT = BOOST_DEDUCED_TYPENAME BOOST_REGEX_DETAIL_NS::regex_iterator_traits<BidirectionalIterator>::value_type,
class traits = regex_traits<charT> >
class regex_token_iterator
#ifndef BOOST_NO_STD_ITERATOR
: public std::iterator<
std::forward_iterator_tag,
sub_match<BidirectionalIterator>,
typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits<BidirectionalIterator>::difference_type,
const sub_match<BidirectionalIterator>*,
const sub_match<BidirectionalIterator>& >
#endif
{
private:
typedef regex_token_iterator_implementation<BidirectionalIterator, charT, traits> impl;
typedef shared_ptr<impl> pimpl;
public:
typedef basic_regex<charT, traits> regex_type;
typedef sub_match<BidirectionalIterator> value_type;
typedef typename BOOST_REGEX_DETAIL_NS::regex_iterator_traits<BidirectionalIterator>::difference_type
difference_type;
typedef const value_type* pointer;
typedef const value_type& reference;
typedef std::forward_iterator_tag iterator_category;
regex_token_iterator(){}
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
int submatch = 0, match_flag_type m = match_default)
: pdata(new impl(&re, b, submatch, m))
{
if(!pdata->init(a))
pdata.reset();
}
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
const std::vector<int>& submatches, match_flag_type m = match_default)
: pdata(new impl(&re, b, submatches, m))
{
if(!pdata->init(a))
pdata.reset();
}
#if !BOOST_WORKAROUND(__HP_aCC, < 60700)
#if (BOOST_WORKAROUND(__BORLANDC__, >= 0x560) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x570)))\
|| BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) \
|| BOOST_WORKAROUND(__HP_aCC, < 60700)
template <class T>
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
const T& submatches, match_flag_type m = match_default)
: pdata(new impl(&re, b, submatches, m))
{
if(!pdata->init(a))
pdata.reset();
}
#else
template <std::size_t N>
regex_token_iterator(BidirectionalIterator a, BidirectionalIterator b, const regex_type& re,
const int (&submatches)[N], match_flag_type m = match_default)
: pdata(new impl(&re, b, submatches, m))
{
if(!pdata->init(a))
pdata.reset();
}
#endif
#endif
regex_token_iterator(const regex_token_iterator& that)
: pdata(that.pdata) {}
regex_token_iterator& operator=(const regex_token_iterator& that)
{
pdata = that.pdata;
return *this;
}
bool operator==(const regex_token_iterator& that)const
{
if((pdata.get() == 0) || (that.pdata.get() == 0))
return pdata.get() == that.pdata.get();
return pdata->compare(*(that.pdata.get()));
}
bool operator!=(const regex_token_iterator& that)const
{ return !(*this == that); }
const value_type& operator*()const
{ return pdata->get(); }
const value_type* operator->()const
{ return &(pdata->get()); }
regex_token_iterator& operator++()
{
cow();
if(0 == pdata->next())
{
pdata.reset();
}
return *this;
}
regex_token_iterator operator++(int)
{
regex_token_iterator result(*this);
++(*this);
return result;
}
private:
pimpl pdata;
void cow()
{
// copy-on-write
if(pdata.get() && !pdata.unique())
{
pdata.reset(new impl(*(pdata.get())));
}
}
};
typedef regex_token_iterator<const char*> cregex_token_iterator;
typedef regex_token_iterator<std::string::const_iterator> sregex_token_iterator;
#ifndef BOOST_NO_WREGEX
typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
typedef regex_token_iterator<std::wstring::const_iterator> wsregex_token_iterator;
#endif
template <class charT, class traits>
inline regex_token_iterator<const charT*, charT, traits> make_regex_token_iterator(const charT* p, const basic_regex<charT, traits>& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
{
return regex_token_iterator<const charT*, charT, traits>(p, p+traits::length(p), e, submatch, m);
}
template <class charT, class traits, class ST, class SA>
inline regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits> make_regex_token_iterator(const std::basic_string<charT, ST, SA>& p, const basic_regex<charT, traits>& e, int submatch = 0, regex_constants::match_flag_type m = regex_constants::match_default)
{
return regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits>(p.begin(), p.end(), e, submatch, m);
}
template <class charT, class traits, std::size_t N>
inline regex_token_iterator<const charT*, charT, traits> make_regex_token_iterator(const charT* p, const basic_regex<charT, traits>& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
{
return regex_token_iterator<const charT*, charT, traits>(p, p+traits::length(p), e, submatch, m);
}
template <class charT, class traits, class ST, class SA, std::size_t N>
inline regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits> make_regex_token_iterator(const std::basic_string<charT, ST, SA>& p, const basic_regex<charT, traits>& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default)
{
return regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits>(p.begin(), p.end(), e, submatch, m);
}
template <class charT, class traits>
inline regex_token_iterator<const charT*, charT, traits> make_regex_token_iterator(const charT* p, const basic_regex<charT, traits>& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
{
return regex_token_iterator<const charT*, charT, traits>(p, p+traits::length(p), e, submatch, m);
}
template <class charT, class traits, class ST, class SA>
inline regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits> make_regex_token_iterator(const std::basic_string<charT, ST, SA>& p, const basic_regex<charT, traits>& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default)
{
return regex_token_iterator<typename std::basic_string<charT, ST, SA>::const_iterator, charT, traits>(p.begin(), p.end(), e, submatch, m);
}
#ifdef BOOST_MSVC
#pragma warning(pop)
#pragma warning(push)
#pragma warning(disable: 4103)
#endif
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
} // namespace boost
#endif // BOOST_REGEX_V4_REGEX_TOKEN_ITERATOR_HPP
@@ -0,0 +1,774 @@
// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard.
// Copyright (C) 2005-2011 Daniel James
// 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_UNORDERED_DETAIL_MANAGER_HPP_INCLUDED
#define BOOST_UNORDERED_DETAIL_MANAGER_HPP_INCLUDED
#include <boost/config.hpp>
#if defined(BOOST_HAS_PRAGMA_ONCE)
#pragma once
#endif
#include <boost/unordered/detail/util.hpp>
#include <boost/unordered/detail/allocate.hpp>
namespace boost { namespace unordered { namespace detail {
template <typename Types> struct table;
template <typename NodePointer> struct bucket;
struct ptr_bucket;
template <typename Types> struct table_impl;
template <typename Types> struct grouped_table_impl;
}}}
// The 'iterator_detail' namespace was a misguided attempt at avoiding ADL
// in the detail namespace. It didn't work because the template parameters
// were in detail. I'm not changing it at the moment to be safe. I might
// do in the future if I change the iterator types.
namespace boost { namespace unordered { namespace iterator_detail {
////////////////////////////////////////////////////////////////////////////
// Iterators
//
// all no throw
template <typename Node> struct iterator;
template <typename Node> struct c_iterator;
template <typename Node, typename Policy> struct l_iterator;
template <typename Node, typename Policy>
struct cl_iterator;
// Local Iterators
//
// all no throw
template <typename Node, typename Policy>
struct l_iterator
: public std::iterator<
std::forward_iterator_tag,
typename Node::value_type,
std::ptrdiff_t,
typename Node::value_type*,
typename Node::value_type&>
{
#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
template <typename Node2, typename Policy2>
friend struct boost::unordered::iterator_detail::cl_iterator;
private:
#endif
typedef typename Node::node_pointer node_pointer;
node_pointer ptr_;
std::size_t bucket_;
std::size_t bucket_count_;
public:
typedef typename Node::value_type value_type;
l_iterator() BOOST_NOEXCEPT : ptr_() {}
l_iterator(node_pointer n, std::size_t b, std::size_t c) BOOST_NOEXCEPT
: ptr_(n), bucket_(b), bucket_count_(c) {}
value_type& operator*() const {
return ptr_->value();
}
value_type* operator->() const {
return ptr_->value_ptr();
}
l_iterator& operator++() {
ptr_ = static_cast<node_pointer>(ptr_->next_);
if (ptr_ && Policy::to_bucket(bucket_count_, ptr_->hash_)
!= bucket_)
ptr_ = node_pointer();
return *this;
}
l_iterator operator++(int) {
l_iterator tmp(*this);
++(*this);
return tmp;
}
bool operator==(l_iterator x) const BOOST_NOEXCEPT {
return ptr_ == x.ptr_;
}
bool operator!=(l_iterator x) const BOOST_NOEXCEPT {
return ptr_ != x.ptr_;
}
};
template <typename Node, typename Policy>
struct cl_iterator
: public std::iterator<
std::forward_iterator_tag,
typename Node::value_type,
std::ptrdiff_t,
typename Node::value_type const*,
typename Node::value_type const&>
{
friend struct boost::unordered::iterator_detail::l_iterator
<Node, Policy>;
private:
typedef typename Node::node_pointer node_pointer;
node_pointer ptr_;
std::size_t bucket_;
std::size_t bucket_count_;
public:
typedef typename Node::value_type value_type;
cl_iterator() BOOST_NOEXCEPT : ptr_() {}
cl_iterator(node_pointer n, std::size_t b, std::size_t c) BOOST_NOEXCEPT :
ptr_(n), bucket_(b), bucket_count_(c) {}
cl_iterator(boost::unordered::iterator_detail::l_iterator<
Node, Policy> const& x) BOOST_NOEXCEPT :
ptr_(x.ptr_), bucket_(x.bucket_), bucket_count_(x.bucket_count_)
{}
value_type const& operator*() const {
return ptr_->value();
}
value_type const* operator->() const {
return ptr_->value_ptr();
}
cl_iterator& operator++() {
ptr_ = static_cast<node_pointer>(ptr_->next_);
if (ptr_ && Policy::to_bucket(bucket_count_, ptr_->hash_)
!= bucket_)
ptr_ = node_pointer();
return *this;
}
cl_iterator operator++(int) {
cl_iterator tmp(*this);
++(*this);
return tmp;
}
friend bool operator==(cl_iterator const& x, cl_iterator const& y)
BOOST_NOEXCEPT
{
return x.ptr_ == y.ptr_;
}
friend bool operator!=(cl_iterator const& x, cl_iterator const& y)
BOOST_NOEXCEPT
{
return x.ptr_ != y.ptr_;
}
};
template <typename Node>
struct iterator
: public std::iterator<
std::forward_iterator_tag,
typename Node::value_type,
std::ptrdiff_t,
typename Node::value_type*,
typename Node::value_type&>
{
#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
template <typename>
friend struct boost::unordered::iterator_detail::c_iterator;
template <typename>
friend struct boost::unordered::detail::table;
template <typename>
friend struct boost::unordered::detail::table_impl;
template <typename>
friend struct boost::unordered::detail::grouped_table_impl;
private:
#endif
typedef typename Node::node_pointer node_pointer;
node_pointer node_;
public:
typedef typename Node::value_type value_type;
iterator() BOOST_NOEXCEPT : node_() {}
explicit iterator(typename Node::link_pointer x) BOOST_NOEXCEPT :
node_(static_cast<node_pointer>(x)) {}
value_type& operator*() const {
return node_->value();
}
value_type* operator->() const {
return node_->value_ptr();
}
iterator& operator++() {
node_ = static_cast<node_pointer>(node_->next_);
return *this;
}
iterator operator++(int) {
iterator tmp(node_);
node_ = static_cast<node_pointer>(node_->next_);
return tmp;
}
bool operator==(iterator const& x) const BOOST_NOEXCEPT {
return node_ == x.node_;
}
bool operator!=(iterator const& x) const BOOST_NOEXCEPT {
return node_ != x.node_;
}
};
template <typename Node>
struct c_iterator
: public std::iterator<
std::forward_iterator_tag,
typename Node::value_type,
std::ptrdiff_t,
typename Node::value_type const*,
typename Node::value_type const&>
{
friend struct boost::unordered::iterator_detail::iterator<Node>;
#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS)
template <typename>
friend struct boost::unordered::detail::table;
template <typename>
friend struct boost::unordered::detail::table_impl;
template <typename>
friend struct boost::unordered::detail::grouped_table_impl;
private:
#endif
typedef typename Node::node_pointer node_pointer;
typedef boost::unordered::iterator_detail::iterator<Node> n_iterator;
node_pointer node_;
public:
typedef typename Node::value_type value_type;
c_iterator() BOOST_NOEXCEPT : node_() {}
explicit c_iterator(typename Node::link_pointer x) BOOST_NOEXCEPT :
node_(static_cast<node_pointer>(x)) {}
c_iterator(n_iterator const& x) BOOST_NOEXCEPT : node_(x.node_) {}
value_type const& operator*() const {
return node_->value();
}
value_type const* operator->() const {
return node_->value_ptr();
}
c_iterator& operator++() {
node_ = static_cast<node_pointer>(node_->next_);
return *this;
}
c_iterator operator++(int) {
c_iterator tmp(node_);
node_ = static_cast<node_pointer>(node_->next_);
return tmp;
}
friend bool operator==(c_iterator const& x, c_iterator const& y)
BOOST_NOEXCEPT
{
return x.node_ == y.node_;
}
friend bool operator!=(c_iterator const& x, c_iterator const& y)
BOOST_NOEXCEPT
{
return x.node_ != y.node_;
}
};
}}}
namespace boost { namespace unordered { namespace detail {
///////////////////////////////////////////////////////////////////
//
// Node Holder
//
// Temporary store for nodes. Deletes any that aren't used.
template <typename NodeAlloc>
struct node_holder
{
private:
typedef NodeAlloc node_allocator;
typedef boost::unordered::detail::allocator_traits<NodeAlloc>
node_allocator_traits;
typedef typename node_allocator_traits::value_type node;
typedef typename node_allocator_traits::pointer node_pointer;
typedef typename node::value_type value_type;
typedef typename node::link_pointer link_pointer;
typedef boost::unordered::iterator_detail::iterator<node> iterator;
node_constructor<NodeAlloc> constructor_;
node_pointer nodes_;
public:
template <typename Table>
explicit node_holder(Table& b) :
constructor_(b.node_alloc()),
nodes_()
{
if (b.size_) {
typename Table::link_pointer prev = b.get_previous_start();
nodes_ = static_cast<node_pointer>(prev->next_);
prev->next_ = link_pointer();
b.size_ = 0;
}
}
~node_holder();
node_pointer pop_node()
{
node_pointer n = nodes_;
nodes_ = static_cast<node_pointer>(nodes_->next_);
n->init(n);
n->next_ = link_pointer();
return n;
}
template <typename T>
inline node_pointer copy_of(T const& v) {
if (nodes_) {
constructor_.reclaim(pop_node());
}
else {
constructor_.create_node();
}
boost::unordered::detail::func::call_construct(
constructor_.alloc_, constructor_.node_->value_ptr(), v);
return constructor_.release();
}
template <typename T>
inline node_pointer move_copy_of(T& v) {
if (nodes_) {
constructor_.reclaim(pop_node());
}
else {
constructor_.create_node();
}
boost::unordered::detail::func::call_construct(
constructor_.alloc_, constructor_.node_->value_ptr(),
boost::move(v));
return constructor_.release();
}
iterator begin() const
{
return iterator(nodes_);
}
};
template <typename Alloc>
node_holder<Alloc>::~node_holder()
{
while (nodes_) {
node_pointer p = nodes_;
nodes_ = static_cast<node_pointer>(p->next_);
boost::unordered::detail::func::call_destroy(constructor_.alloc_,
p->value_ptr());
boost::unordered::detail::func::destroy(boost::addressof(*p));
node_allocator_traits::deallocate(constructor_.alloc_, p, 1);
}
}
///////////////////////////////////////////////////////////////////
//
// Bucket
template <typename NodePointer>
struct bucket
{
typedef NodePointer link_pointer;
link_pointer next_;
bucket() : next_() {}
link_pointer first_from_start()
{
return next_;
}
enum { extra_node = true };
};
struct ptr_bucket
{
typedef ptr_bucket* link_pointer;
link_pointer next_;
ptr_bucket() : next_(0) {}
link_pointer first_from_start()
{
return this;
}
enum { extra_node = false };
};
///////////////////////////////////////////////////////////////////
//
// Hash Policy
template <typename SizeT>
struct prime_policy
{
template <typename Hash, typename T>
static inline SizeT apply_hash(Hash const& hf, T const& x) {
return hf(x);
}
static inline SizeT to_bucket(SizeT bucket_count, SizeT hash) {
return hash % bucket_count;
}
static inline SizeT new_bucket_count(SizeT min) {
return boost::unordered::detail::next_prime(min);
}
static inline SizeT prev_bucket_count(SizeT max) {
return boost::unordered::detail::prev_prime(max);
}
};
template <typename SizeT>
struct mix64_policy
{
template <typename Hash, typename T>
static inline SizeT apply_hash(Hash const& hf, T const& x) {
SizeT key = hf(x);
key = (~key) + (key << 21); // key = (key << 21) - key - 1;
key = key ^ (key >> 24);
key = (key + (key << 3)) + (key << 8); // key * 265
key = key ^ (key >> 14);
key = (key + (key << 2)) + (key << 4); // key * 21
key = key ^ (key >> 28);
key = key + (key << 31);
return key;
}
static inline SizeT to_bucket(SizeT bucket_count, SizeT hash) {
return hash & (bucket_count - 1);
}
static inline SizeT new_bucket_count(SizeT min) {
if (min <= 4) return 4;
--min;
min |= min >> 1;
min |= min >> 2;
min |= min >> 4;
min |= min >> 8;
min |= min >> 16;
min |= min >> 32;
return min + 1;
}
static inline SizeT prev_bucket_count(SizeT max) {
max |= max >> 1;
max |= max >> 2;
max |= max >> 4;
max |= max >> 8;
max |= max >> 16;
max |= max >> 32;
return (max >> 1) + 1;
}
};
template <int digits, int radix>
struct pick_policy_impl {
typedef prime_policy<std::size_t> type;
};
template <>
struct pick_policy_impl<64, 2> {
typedef mix64_policy<std::size_t> type;
};
template <typename T>
struct pick_policy :
pick_policy_impl<
std::numeric_limits<std::size_t>::digits,
std::numeric_limits<std::size_t>::radix> {};
// While the mix policy is generally faster, the prime policy is a lot
// faster when a large number consecutive integers are used, because
// there are no collisions. Since that is probably quite common, use
// prime policy for integeral types. But not the smaller ones, as they
// don't have enough unique values for this to be an issue.
template <>
struct pick_policy<int> {
typedef prime_policy<std::size_t> type;
};
template <>
struct pick_policy<unsigned int> {
typedef prime_policy<std::size_t> type;
};
template <>
struct pick_policy<long> {
typedef prime_policy<std::size_t> type;
};
template <>
struct pick_policy<unsigned long> {
typedef prime_policy<std::size_t> type;
};
// TODO: Maybe not if std::size_t is smaller than long long.
#if !defined(BOOST_NO_LONG_LONG)
template <>
struct pick_policy<boost::long_long_type> {
typedef prime_policy<std::size_t> type;
};
template <>
struct pick_policy<boost::ulong_long_type> {
typedef prime_policy<std::size_t> type;
};
#endif
////////////////////////////////////////////////////////////////////////////
// Functions
// Assigning and swapping the equality and hash function objects
// needs strong exception safety. To implement that normally we'd
// require one of them to be known to not throw and the other to
// guarantee strong exception safety. Unfortunately they both only
// have basic exception safety. So to acheive strong exception
// safety we have storage space for two copies, and assign the new
// copies to the unused space. Then switch to using that to use
// them. This is implemented in 'set_hash_functions' which
// atomically assigns the new function objects in a strongly
// exception safe manner.
template <class H, class P, bool NoThrowMoveAssign>
class set_hash_functions;
template <class H, class P>
class functions
{
public:
static const bool nothrow_move_assignable =
boost::is_nothrow_move_assignable<H>::value &&
boost::is_nothrow_move_assignable<P>::value;
static const bool nothrow_move_constructible =
boost::is_nothrow_move_constructible<H>::value &&
boost::is_nothrow_move_constructible<P>::value;
private:
friend class boost::unordered::detail::set_hash_functions<H, P,
nothrow_move_assignable>;
functions& operator=(functions const&);
typedef compressed<H, P> function_pair;
typedef typename boost::aligned_storage<
sizeof(function_pair),
boost::alignment_of<function_pair>::value>::type aligned_function;
bool current_; // The currently active functions.
aligned_function funcs_[2];
function_pair const& current() const {
return *static_cast<function_pair const*>(
static_cast<void const*>(&funcs_[current_]));
}
function_pair& current() {
return *static_cast<function_pair*>(
static_cast<void*>(&funcs_[current_]));
}
void construct(bool which, H const& hf, P const& eq)
{
new((void*) &funcs_[which]) function_pair(hf, eq);
}
void construct(bool which, function_pair const& f,
boost::unordered::detail::false_type =
boost::unordered::detail::false_type())
{
new((void*) &funcs_[which]) function_pair(f);
}
void construct(bool which, function_pair& f,
boost::unordered::detail::true_type)
{
new((void*) &funcs_[which]) function_pair(f,
boost::unordered::detail::move_tag());
}
void destroy(bool which)
{
boost::unordered::detail::func::destroy((function_pair*)(&funcs_[which]));
}
public:
typedef boost::unordered::detail::set_hash_functions<H, P,
nothrow_move_assignable> set_hash_functions;
functions(H const& hf, P const& eq)
: current_(false)
{
construct(current_, hf, eq);
}
functions(functions const& bf)
: current_(false)
{
construct(current_, bf.current());
}
functions(functions& bf, boost::unordered::detail::move_tag)
: current_(false)
{
construct(current_, bf.current(),
boost::unordered::detail::integral_constant<bool,
nothrow_move_constructible>());
}
~functions() {
this->destroy(current_);
}
H const& hash_function() const {
return current().first();
}
P const& key_eq() const {
return current().second();
}
};
template <class H, class P>
class set_hash_functions<H, P, false>
{
set_hash_functions(set_hash_functions const&);
set_hash_functions& operator=(set_hash_functions const&);
typedef functions<H, P> functions_type;
functions_type& functions_;
bool tmp_functions_;
public:
set_hash_functions(functions_type& f, H const& h, P const& p)
: functions_(f),
tmp_functions_(!f.current_)
{
f.construct(tmp_functions_, h, p);
}
set_hash_functions(functions_type& f, functions_type const& other)
: functions_(f),
tmp_functions_(!f.current_)
{
f.construct(tmp_functions_, other.current());
}
~set_hash_functions()
{
functions_.destroy(tmp_functions_);
}
void commit()
{
functions_.current_ = tmp_functions_;
tmp_functions_ = !tmp_functions_;
}
};
template <class H, class P>
class set_hash_functions<H, P, true>
{
set_hash_functions(set_hash_functions const&);
set_hash_functions& operator=(set_hash_functions const&);
typedef functions<H, P> functions_type;
functions_type& functions_;
H hash_;
P pred_;
public:
set_hash_functions(functions_type& f, H const& h, P const& p) :
functions_(f),
hash_(h),
pred_(p) {}
set_hash_functions(functions_type& f, functions_type const& other) :
functions_(f),
hash_(other.hash_function()),
pred_(other.key_eq()) {}
void commit()
{
functions_.current().first() = boost::move(hash_);
functions_.current().second() = boost::move(pred_);
}
};
////////////////////////////////////////////////////////////////////////////
// rvalue parameters when type can't be a BOOST_RV_REF(T) parameter
// e.g. for int
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
# define BOOST_UNORDERED_RV_REF(T) BOOST_RV_REF(T)
#else
struct please_ignore_this_overload {
typedef please_ignore_this_overload type;
};
template <typename T>
struct rv_ref_impl {
typedef BOOST_RV_REF(T) type;
};
template <typename T>
struct rv_ref :
boost::detail::if_true<
boost::is_class<T>::value
>::BOOST_NESTED_TEMPLATE then <
boost::unordered::detail::rv_ref_impl<T>,
please_ignore_this_overload
>::type
{};
# define BOOST_UNORDERED_RV_REF(T) \
typename boost::unordered::detail::rv_ref<T>::type
#endif
}}}
#endif
@@ -0,0 +1,44 @@
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
#include <boost/proto/detail/preprocessed/template_arity_helper.hpp>
#elif !defined(BOOST_PP_IS_ITERATING)
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/template_arity_helper.hpp")
#endif
///////////////////////////////////////////////////////////////////////////////
// template_arity_helper.hpp
// Overloads of template_arity_helper, used by the template_arity\<\> class template
//
// 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
#define BOOST_PP_ITERATION_PARAMS_1 \
(3, (1, BOOST_PROTO_MAX_ARITY, <boost/proto/detail/template_arity_helper.hpp>))
#include BOOST_PP_ITERATE()
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
#pragma wave option(output: null)
#endif
#else
#define N BOOST_PP_ITERATION()
template<
template<BOOST_PP_ENUM_PARAMS(N, typename P)> class F
, BOOST_PP_ENUM_PARAMS(N, typename T)
>
sized_type<BOOST_PP_INC(N)>::type
template_arity_helper(F<BOOST_PP_ENUM_PARAMS(N, T)> **, mpl::int_<N> *);
#undef N
#endif // BOOST_PROTO_DONT_USE_PREPROCESSED_FILES
@@ -0,0 +1,67 @@
#ifndef BOOST_MPL_IS_PLACEHOLDER_HPP_INCLUDED
#define BOOST_MPL_IS_PLACEHOLDER_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2001-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)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/arg_fwd.hpp>
#include <boost/mpl/bool.hpp>
#include <boost/mpl/aux_/yes_no.hpp>
#include <boost/mpl/aux_/type_wrapper.hpp>
#include <boost/mpl/aux_/nttp_decl.hpp>
#include <boost/mpl/aux_/config/ctps.hpp>
#include <boost/mpl/aux_/config/static_constant.hpp>
namespace boost { namespace mpl {
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
template< typename T >
struct is_placeholder
: bool_<false>
{
};
template< BOOST_MPL_AUX_NTTP_DECL(int, N) >
struct is_placeholder< arg<N> >
: bool_<true>
{
};
#else
namespace aux {
aux::no_tag is_placeholder_helper(...);
template< BOOST_MPL_AUX_NTTP_DECL(int, N) >
aux::yes_tag is_placeholder_helper(aux::type_wrapper< arg<N> >*);
} // namespace aux
template< typename T >
struct is_placeholder
{
static aux::type_wrapper<T>* get();
BOOST_STATIC_CONSTANT(bool, value =
sizeof(aux::is_placeholder_helper(get())) == sizeof(aux::yes_tag)
);
typedef bool_<value> type;
};
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
}}
#endif // BOOST_MPL_IS_PLACEHOLDER_HPP_INCLUDED
@@ -0,0 +1,370 @@
// Copyright 2014 Neil Groves
//
// Copyright (c) 2010 Ilya Murav'jov
//
// 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)
//
// Credits:
// My (Neil's) first indexed adaptor was hindered by having the underlying
// iterator return the same reference as the wrapped iterator. This meant that
// to obtain the index one had to get to the index_iterator and call the
// index() function on it. Ilya politely pointed out that this was useless in
// a number of scenarios since one naturally hides the use of iterators in
// good range-based code. Ilya provided a new interface (which has remained)
// and a first implementation. Much of this original implementation has
// been simplified and now supports more compilers and platforms.
//
#ifndef BOOST_RANGE_ADAPTOR_INDEXED_HPP_INCLUDED
#define BOOST_RANGE_ADAPTOR_INDEXED_HPP_INCLUDED
#include <boost/range/config.hpp>
#include <boost/range/adaptor/argument_fwd.hpp>
#include <boost/range/iterator_range.hpp>
#include <boost/range/traversal.hpp>
#include <boost/range/size.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/mpl/if.hpp>
#include <boost/type_traits/is_convertible.hpp>
#include <boost/iterator/iterator_traits.hpp>
#include <boost/iterator/iterator_facade.hpp>
#include <boost/tuple/tuple.hpp>
namespace boost
{
namespace adaptors
{
struct indexed
{
explicit indexed(std::ptrdiff_t x = 0)
: val(x)
{
}
std::ptrdiff_t val;
};
} // namespace adaptors
namespace range
{
// Why yet another "pair" class:
// - std::pair can't store references
// - no need for typing for index type (default to "std::ptrdiff_t"); this is
// useful in BOOST_FOREACH() expressions that have pitfalls with commas
// ( see http://www.boost.org/doc/libs/1_44_0/doc/html/foreach/pitfalls.html )
// - meaningful access functions index(), value()
template<class T, class Indexable = std::ptrdiff_t>
class index_value
: public tuple<Indexable, T>
{
typedef tuple<Indexable, T> base_t;
template<int N>
struct iv_types
{
typedef typename tuples::element<N, base_t>::type n_type;
typedef typename tuples::access_traits<n_type>::non_const_type non_const_type;
typedef typename tuples::access_traits<n_type>::const_type const_type;
};
public:
typedef typename iv_types<0>::non_const_type index_type;
typedef typename iv_types<0>::const_type const_index_type;
typedef typename iv_types<1>::non_const_type value_type;
typedef typename iv_types<1>::const_type const_value_type;
index_value()
{
}
index_value(typename tuples::access_traits<Indexable>::parameter_type t0,
typename tuples::access_traits<T>::parameter_type t1)
: base_t(t0, t1)
{
}
// member functions index(), value() (non-const and const)
index_type index()
{
return boost::tuples::get<0>(*this);
}
const_index_type index() const
{
return boost::tuples::get<0>(*this);
}
value_type value()
{
return boost::tuples::get<1>(*this);
}
const_value_type value() const
{
return boost::tuples::get<1>(*this);
}
};
} // namespace range
namespace range_detail
{
template<typename Iter>
struct indexed_iterator_value_type
{
typedef ::boost::range::index_value<
typename iterator_reference<Iter>::type,
typename iterator_difference<Iter>::type
> type;
};
// Meta-function to get the traversal for the range and therefore iterator
// returned by the indexed adaptor for a specified iterator type.
//
// Random access -> Random access
// Bidirectional -> Forward
// Forward -> Forward
// SinglePass -> SinglePass
//
// The rationale for demoting a Bidirectional input to Forward is that the end
// iterator cannot cheaply have an index computed for it. Therefore I chose to
// demote to forward traversal. I can maintain the ability to traverse randomly
// when the input is Random Access since the index for the end iterator is cheap
// to compute.
template<typename Iter>
struct indexed_traversal
{
private:
typedef typename iterator_traversal<Iter>::type wrapped_traversal;
public:
typedef typename mpl::if_<
is_convertible<wrapped_traversal, random_access_traversal_tag>,
random_access_traversal_tag,
typename mpl::if_<
is_convertible<wrapped_traversal, bidirectional_traversal_tag>,
forward_traversal_tag,
wrapped_traversal
>::type
>::type type;
};
template<typename Iter>
class indexed_iterator
: public iterator_facade<
indexed_iterator<Iter>,
typename indexed_iterator_value_type<Iter>::type,
typename indexed_traversal<Iter>::type,
typename indexed_iterator_value_type<Iter>::type,
typename iterator_difference<Iter>::type
>
{
public:
typedef Iter wrapped;
private:
typedef iterator_facade<
indexed_iterator<wrapped>,
typename indexed_iterator_value_type<wrapped>::type,
typename indexed_traversal<wrapped>::type,
typename indexed_iterator_value_type<wrapped>::type,
typename iterator_difference<wrapped>::type
> base_t;
public:
typedef typename base_t::difference_type difference_type;
typedef typename base_t::reference reference;
typedef typename base_t::difference_type index_type;
indexed_iterator()
: m_it()
, m_index()
{
}
template<typename OtherWrapped>
indexed_iterator(
const indexed_iterator<OtherWrapped>& other,
typename enable_if<is_convertible<OtherWrapped, wrapped> >::type* = 0
)
: m_it(other.get())
, m_index(other.get_index())
{
}
explicit indexed_iterator(wrapped it, index_type index)
: m_it(it)
, m_index(index)
{
}
wrapped get() const
{
return m_it;
}
index_type get_index() const
{
return m_index;
}
private:
friend class boost::iterator_core_access;
reference dereference() const
{
return reference(m_index, *m_it);
}
bool equal(const indexed_iterator& other) const
{
return m_it == other.m_it;
}
void increment()
{
++m_index;
++m_it;
}
void decrement()
{
BOOST_ASSERT_MSG(m_index > 0, "indexed Iterator out of bounds");
--m_index;
--m_it;
}
void advance(index_type n)
{
m_index += n;
BOOST_ASSERT_MSG(m_index >= 0, "indexed Iterator out of bounds");
m_it += n;
}
difference_type distance_to(const indexed_iterator& other) const
{
return other.m_it - m_it;
}
wrapped m_it;
index_type m_index;
};
template<typename SinglePassRange>
struct indexed_range
: iterator_range<
indexed_iterator<
typename range_iterator<SinglePassRange>::type
>
>
{
typedef iterator_range<
indexed_iterator<
typename range_iterator<SinglePassRange>::type
>
> base_t;
BOOST_RANGE_CONCEPT_ASSERT((
boost::SinglePassRangeConcept<SinglePassRange>));
public:
typedef indexed_iterator<
typename range_iterator<SinglePassRange>::type
> iterator;
// Constructor for non-random access iterators.
// This sets the end iterator index to i despite this being incorrect it
// is never observable since bidirectional iterators are demoted to
// forward iterators.
indexed_range(
typename base_t::difference_type i,
SinglePassRange& r,
single_pass_traversal_tag
)
: base_t(iterator(boost::begin(r), i),
iterator(boost::end(r), i))
{
}
indexed_range(
typename base_t::difference_type i,
SinglePassRange& r,
random_access_traversal_tag
)
: base_t(iterator(boost::begin(r), i),
iterator(boost::end(r), i + boost::size(r)))
{
}
};
} // namespace range_detail
using range_detail::indexed_range;
namespace adaptors
{
template<class SinglePassRange>
inline indexed_range<SinglePassRange>
operator|(SinglePassRange& r, indexed e)
{
BOOST_RANGE_CONCEPT_ASSERT((
boost::SinglePassRangeConcept<SinglePassRange>
));
return indexed_range<SinglePassRange>(
e.val, r,
typename range_traversal<SinglePassRange>::type());
}
template<class SinglePassRange>
inline indexed_range<const SinglePassRange>
operator|(const SinglePassRange& r, indexed e)
{
BOOST_RANGE_CONCEPT_ASSERT((
boost::SinglePassRangeConcept<const SinglePassRange>
));
return indexed_range<const SinglePassRange>(
e.val, r,
typename range_traversal<const SinglePassRange>::type());
}
template<class SinglePassRange>
inline indexed_range<SinglePassRange>
index(
SinglePassRange& rng,
typename range_difference<SinglePassRange>::type index_value = 0)
{
BOOST_RANGE_CONCEPT_ASSERT((
boost::SinglePassRangeConcept<SinglePassRange>
));
return indexed_range<SinglePassRange>(
index_value, rng,
typename range_traversal<SinglePassRange>::type());
}
template<class SinglePassRange>
inline indexed_range<const SinglePassRange>
index(
const SinglePassRange& rng,
typename range_difference<const SinglePassRange>::type index_value = 0)
{
BOOST_RANGE_CONCEPT_ASSERT((
boost::SinglePassRangeConcept<SinglePassRange>
));
return indexed_range<const SinglePassRange>(
index_value, rng,
typename range_traversal<const SinglePassRange>::type());
}
} // namespace adaptors
} // namespace boost
#endif // include guard
@@ -0,0 +1,20 @@
#include "Radio.hpp"
#include <QMetaType>
#include <QDebug>
#include <QDataStream>
namespace Radio
{
void register_types ()
{
qRegisterMetaType<Radio::Frequency> ("Frequency");
qRegisterMetaType<Radio::FrequencyDelta> ("FrequencyDelta");
qRegisterMetaType<Radio::Frequencies> ("Frequencies");
// This is required to preserve v1.5 "frequencies" setting for
// backwards compatibility, without it the setting gets trashed
// by later versions.
qRegisterMetaTypeStreamOperators<Radio::Frequencies> ("Frequencies");
}
}
@@ -0,0 +1,32 @@
# /* **************************************************************************
# * *
# * (C) Copyright Edward Diener 2011. *
# * (C) Copyright Paul Mensonides 2011. *
# * 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 for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_VARIADIC_TO_ARRAY_HPP
# define BOOST_PREPROCESSOR_VARIADIC_TO_ARRAY_HPP
#
# include <boost/preprocessor/config/config.hpp>
# include <boost/preprocessor/tuple/to_array.hpp>
# if BOOST_PP_VARIADICS_MSVC
# include <boost/preprocessor/variadic/size.hpp>
# endif
#
# /* BOOST_PP_VARIADIC_TO_ARRAY */
#
# if BOOST_PP_VARIADICS
# if BOOST_PP_VARIADICS_MSVC
# define BOOST_PP_VARIADIC_TO_ARRAY(...) BOOST_PP_TUPLE_TO_ARRAY_2(BOOST_PP_VARIADIC_SIZE(__VA_ARGS__),(__VA_ARGS__))
# else
# define BOOST_PP_VARIADIC_TO_ARRAY(...) BOOST_PP_TUPLE_TO_ARRAY((__VA_ARGS__))
# endif
# endif
#
# endif
@@ -0,0 +1,25 @@
#ifndef BOOST_MPL_HAS_KEY_FWD_HPP_INCLUDED
#define BOOST_MPL_HAS_KEY_FWD_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2003-2004
// Copyright David Abrahams 2003-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)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
namespace boost { namespace mpl {
template< typename Tag > struct has_key_impl;
template< typename AssociativeSequence, typename Key > struct has_key;
}}
#endif // BOOST_MPL_HAS_KEY_FWD_HPP_INCLUDED
@@ -0,0 +1,42 @@
//---------------------------------------------------------------------------//
// 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_FUNCTIONAL_DETAIL_NVIDIA_POPCOUNT_HPP
#define BOOST_COMPUTE_FUNCTIONAL_DETAIL_NVIDIA_POPCOUNT_HPP
#include <boost/compute/function.hpp>
namespace boost {
namespace compute {
namespace detail {
template<class T>
class nvidia_popcount : public function<T(T)>
{
public:
nvidia_popcount()
: function<T(T)>("nvidia_popcount")
{
this->set_source(
"inline uint nvidia_popcount(const uint x)\n"
"{\n"
" uint count;\n"
" asm(\"popc.b32 %0, %1;\" : \"=r\"(count) : \"r\"(x));\n"
" return count;\n"
"}\n"
);
}
};
} // end detail namespace
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_FUNCTIONAL_DETAIL_NVIDIA_POPCOUNT_HPP
@@ -0,0 +1,32 @@
# /* **************************************************************************
# * *
# * (C) Copyright Edward Diener 2013.
# * 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 for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_TUPLE_PUSH_FRONT_HPP
# define BOOST_PREPROCESSOR_TUPLE_PUSH_FRONT_HPP
#
# include <boost/preprocessor/config/config.hpp>
#
# if BOOST_PP_VARIADICS
#
# include <boost/preprocessor/array/push_front.hpp>
# include <boost/preprocessor/array/to_tuple.hpp>
# include <boost/preprocessor/tuple/to_array.hpp>
#
#
# /* BOOST_PP_TUPLE_PUSH_FRONT */
#
# define BOOST_PP_TUPLE_PUSH_FRONT(tuple, elem) \
BOOST_PP_ARRAY_TO_TUPLE(BOOST_PP_ARRAY_PUSH_FRONT(BOOST_PP_TUPLE_TO_ARRAY(tuple), elem)) \
/**/
#
# endif // BOOST_PP_VARIADICS
#
# endif // BOOST_PREPROCESSOR_TUPLE_PUSH_FRONT_HPP
@@ -0,0 +1,25 @@
/*=============================================================================
Copyright (c) 2011 Hartmut Kaiser
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(BOOST_PHOENIX_PREPROCESSED_BIND_FUNCTION_HPP)
#define BOOST_PHOENIX_PREPROCESSED_BIND_FUNCTION_HPP
#if BOOST_PHOENIX_LIMIT <= 10
#include <boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_10.hpp>
#elif BOOST_PHOENIX_LIMIT <= 20
#include <boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_20.hpp>
#elif BOOST_PHOENIX_LIMIT <= 30
#include <boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_30.hpp>
#elif BOOST_PHOENIX_LIMIT <= 40
#include <boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_40.hpp>
#elif BOOST_PHOENIX_LIMIT <= 50
#include <boost/phoenix/bind/detail/cpp03/preprocessed/bind_function_50.hpp>
#else
#error "BOOST_PHOENIX_LIMIT out of bounds for preprocessed headers"
#endif
#endif
@@ -0,0 +1,152 @@
#ifndef BOOST_SERIALIZATION_SINGLETON_HPP
#define BOOST_SERIALIZATION_SINGLETON_HPP
/////////1/////////2///////// 3/////////4/////////5/////////6/////////7/////////8
// singleton.hpp
//
// Copyright David Abrahams 2006. Original version
//
// Copyright Robert Ramey 2007. Changes made to permit
// application throughout the serialization library.
//
// 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)
//
// The intention here is to define a template which will convert
// any class into a singleton with the following features:
//
// a) initialized before first use.
// b) thread-safe for const access to the class
// c) non-locking
//
// In order to do this,
// a) Initialize dynamically when used.
// b) Require that all singletons be initialized before main
// is called or any entry point into the shared library is invoked.
// This guarentees no race condition for initialization.
// In debug mode, we assert that no non-const functions are called
// after main is invoked.
//
// MS compatible compilers support #pragma once
#if defined(_MSC_VER)
# pragma once
#endif
#include <boost/assert.hpp>
#include <boost/config.hpp>
#include <boost/noncopyable.hpp>
#include <boost/serialization/force_include.hpp>
#include <boost/archive/detail/auto_link_archive.hpp>
#include <boost/serialization/config.hpp>
#include <boost/archive/detail/abi_prefix.hpp> // must be the last header
#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable : 4511 4512)
#endif
namespace boost {
namespace serialization {
//////////////////////////////////////////////////////////////////////
// Provides a dynamically-initialized (singleton) instance of T in a
// way that avoids LNK1179 on vc6. See http://tinyurl.com/ljdp8 or
// http://lists.boost.org/Archives/boost/2006/05/105286.php for
// details.
//
// singletons created by this code are guarenteed to be unique
// within the executable or shared library which creates them.
// This is sufficient and in fact ideal for the serialization library.
// The singleton is created when the module is loaded and destroyed
// when the module is unloaded.
// This base class has two functions.
// First it provides a module handle for each singleton indicating
// the executable or shared library in which it was created. This
// turns out to be necessary and sufficient to implement the tables
// used by serialization library.
// Second, it provides a mechanism to detect when a non-const function
// is called after initialization.
// make a singleton to lock/unlock all singletons for alteration.
// The intent is that all singletons created/used by this code
// are to be initialized before main is called. A test program
// can lock all the singletons when main is entereed. This any
// attempt to retieve a mutable instances while locked will
// generate a assertion if compiled for debug.
class BOOST_SYMBOL_VISIBLE singleton_module :
public boost::noncopyable
{
private:
static bool & get_lock();
public:
BOOST_SERIALIZATION_DECL static void lock();
BOOST_SERIALIZATION_DECL static void unlock();
BOOST_SERIALIZATION_DECL static bool is_locked();
};
#include <boost/archive/detail/abi_suffix.hpp> // pops abi_suffix.hpp pragmas
namespace detail {
template<class T>
class singleton_wrapper : public T
{
public:
static bool m_is_destroyed;
~singleton_wrapper(){
m_is_destroyed = true;
}
};
template<class T>
bool detail::singleton_wrapper< T >::m_is_destroyed = false;
} // detail
template <class T>
class singleton : public singleton_module
{
private:
BOOST_DLLEXPORT static T & instance;
// include this to provoke instantiation at pre-execution time
static void use(T const *) {}
BOOST_DLLEXPORT static T & get_instance() {
static detail::singleton_wrapper< T > t;
// refer to instance, causing it to be instantiated (and
// initialized at startup on working compilers)
BOOST_ASSERT(! detail::singleton_wrapper< T >::m_is_destroyed);
use(& instance);
return static_cast<T &>(t);
}
public:
BOOST_DLLEXPORT static T & get_mutable_instance(){
BOOST_ASSERT(! is_locked());
return get_instance();
}
BOOST_DLLEXPORT static const T & get_const_instance(){
return get_instance();
}
BOOST_DLLEXPORT static bool is_destroyed(){
return detail::singleton_wrapper< T >::m_is_destroyed;
}
};
template<class T>
BOOST_DLLEXPORT T & singleton< T >::instance = singleton< T >::get_instance();
} // namespace serialization
} // namespace boost
#ifdef BOOST_MSVC
#pragma warning(pop)
#endif
#endif // BOOST_SERIALIZATION_SINGLETON_HPP
@@ -0,0 +1,53 @@
#ifndef BOOST_MPL_SET_AUX_ERASE_KEY_IMPL_HPP_INCLUDED
#define BOOST_MPL_SET_AUX_ERASE_KEY_IMPL_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2003-2007
// Copyright David Abrahams 2003-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)
//
// See http://www.boost.org/libs/mpl for documentation.
// $Id$
// $Date$
// $Revision$
#include <boost/mpl/erase_key_fwd.hpp>
#include <boost/mpl/set/aux_/has_key_impl.hpp>
#include <boost/mpl/set/aux_/item.hpp>
#include <boost/mpl/set/aux_/tag.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/mpl/base.hpp>
#include <boost/mpl/eval_if.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost { namespace mpl {
template<>
struct erase_key_impl< aux::set_tag >
{
template<
typename Set
, typename T
>
struct apply
: eval_if<
has_key_impl<aux::set_tag>::apply<Set,T>
, eval_if<
is_same< T,typename Set::item_type_ >
, base<Set>
, identity< s_mask<T,typename Set::item_> >
>
, identity<Set>
>
{
};
};
}}
#endif // BOOST_MPL_SET_AUX_ERASE_KEY_IMPL_HPP_INCLUDED
@@ -0,0 +1,84 @@
/* boost random/detail/integer_log2.hpp header file
*
* Copyright Steven Watanabe 2011
* 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 for most recent version including documentation.
*
* $Id$
*
*/
#ifndef BOOST_RANDOM_DETAIL_INTEGER_LOG2_HPP
#define BOOST_RANDOM_DETAIL_INTEGER_LOG2_HPP
#include <boost/config.hpp>
#include <boost/limits.hpp>
#include <boost/pending/integer_log2.hpp>
namespace boost {
namespace random {
namespace detail {
#if !defined(BOOST_NO_CXX11_CONSTEXPR)
#define BOOST_RANDOM_DETAIL_CONSTEXPR constexpr
#elif defined(BOOST_MSVC)
#define BOOST_RANDOM_DETAIL_CONSTEXPR __forceinline
#elif defined(__GNUC__) && __GNUC__ >= 4
#define BOOST_RANDOM_DETAIL_CONSTEXPR inline __attribute__((__const__)) __attribute__((__always_inline__))
#else
#define BOOST_RANDOM_DETAIL_CONSTEXPR inline
#endif
template<int Shift>
struct integer_log2_impl
{
#if defined(BOOST_NO_CXX11_CONSTEXPR)
template<class T>
BOOST_RANDOM_DETAIL_CONSTEXPR static int apply(T t, int accum)
{
int update = ((t >> Shift) != 0) * Shift;
return integer_log2_impl<Shift / 2>::apply(t >> update, accum + update);
}
#else
template<class T>
BOOST_RANDOM_DETAIL_CONSTEXPR static int apply2(T t, int accum, int update)
{
return integer_log2_impl<Shift / 2>::apply(t >> update, accum + update);
}
template<class T>
BOOST_RANDOM_DETAIL_CONSTEXPR static int apply(T t, int accum)
{
return apply2(t, accum, ((t >> Shift) != 0) * Shift);
}
#endif
};
template<>
struct integer_log2_impl<1>
{
template<class T>
BOOST_RANDOM_DETAIL_CONSTEXPR static int apply(T t, int accum)
{
return int(t >> 1) + accum;
}
};
template<class T>
BOOST_RANDOM_DETAIL_CONSTEXPR int integer_log2(T t)
{
return integer_log2_impl<
::boost::detail::max_pow2_less<
::std::numeric_limits<T>::digits, 4
>::value
>::apply(t, 0);
}
} // namespace detail
} // namespace random
} // namespace boost
#endif // BOOST_RANDOM_DETAIL_INTEGER_LOG2_HPP
@@ -0,0 +1,13 @@
/*=============================================================================
Copyright (c) 2001-2007 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_INCLUDE_TUPLE)
#define FUSION_INCLUDE_TUPLE
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/tuple.hpp>
#endif
@@ -0,0 +1,46 @@
// Copyright (C) 2009-2012 Lorenzo Caminiti
// Distributed under the Boost Software License, Version 1.0
// (see accompanying file LICENSE_1_0.txt or a copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Home at http://www.boost.org/libs/utility/identity_type
/** @file
Wrap type expressions with round parenthesis so they can be passed to macros
even if they contain commas.
*/
#ifndef BOOST_IDENTITY_TYPE_HPP_
#define BOOST_IDENTITY_TYPE_HPP_
#include <boost/type_traits/function_traits.hpp>
/**
@brief This macro allows to wrap the specified type expression within extra
round parenthesis so the type can be passed as a single macro parameter even if
it contains commas (not already wrapped within round parenthesis).
@Params
@Param{parenthesized_type,
The type expression to be passed as macro parameter wrapped by a single set
of round parenthesis <c>(...)</c>.
This type expression can contain an arbitrary number of commas.
}
@EndParams
This macro works on any C++03 compiler (it does not use variadic macros).
This macro must be prefixed by <c>typename</c> when used within templates.
Note that the compiler will not be able to automatically determine function
template parameters when they are wrapped with this macro (these parameters
need to be explicitly specified when calling the function template).
On some compilers (like GCC), using this macro on abstract types requires to
add and remove a reference to the specified type.
*/
#define BOOST_IDENTITY_TYPE(parenthesized_type) \
/* must NOT prefix this with `::` to work with parenthesized syntax */ \
boost::function_traits< void parenthesized_type >::arg1_type
#endif // #include guard
@@ -0,0 +1,55 @@
subroutine softsym9f(ss2,ss3,i1SoftSymbols)
! Compute soft symbols and S/N
real ss2(0:8,85)
real ss3(0:7,69)
integer*1 i1SoftSymbolsScrambled(207)
integer*1 i1SoftSymbols(207)
ss=0.
sig=0.
if(ss2(0,1).eq.-999.0) return !Silence compiler warning
do j=1,69
smax=0.
do i=0,7
smax=max(smax,ss3(i,j))
ss=ss+ss3(i,j)
enddo
sig=sig+smax
ss=ss-smax
enddo
ave=ss/(69*7) !Baseline
! call pctile(ss2,9*85,35,xmed) !### better? ###
ss3=ss3/ave
sig=sig/69. !Signal
m0=3
k=0
scale=10.0
do j=1,69
do m=m0-1,0,-1 !Get bit-wise soft symbols
if(m.eq.2) then
r1=max(ss3(4,j),ss3(5,j),ss3(6,j),ss3(7,j))
r0=max(ss3(0,j),ss3(1,j),ss3(2,j),ss3(3,j))
else if(m.eq.1) then
r1=max(ss3(2,j),ss3(3,j),ss3(4,j),ss3(5,j))
r0=max(ss3(0,j),ss3(1,j),ss3(6,j),ss3(7,j))
else
r1=max(ss3(1,j),ss3(2,j),ss3(4,j),ss3(7,j))
r0=max(ss3(0,j),ss3(3,j),ss3(5,j),ss3(6,j))
endif
k=k+1
i4=nint(scale*(r1-r0))
if(i4.lt.-127) i4=-127
if(i4.gt.127) i4=127
i1SoftSymbolsScrambled(k)=i4
enddo
enddo
call interleave9(i1SoftSymbolsScrambled,-1,i1SoftSymbols)
return
end subroutine softsym9f
@@ -0,0 +1,4 @@
1
4
1.0
@@ -0,0 +1,35 @@
// Copyright Aleksey Gurtovoy 2001-2006
//
// 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/mpl for documentation.
// $Id$
// $Date$
// $Revision$
// NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION!
#include <boost/mpl/aux_/config/workaround.hpp>
#include <boost/preprocessor/cat.hpp>
#include <boost/preprocessor/stringize.hpp>
# define AUX778076_HEADER \
aux_/preprocessed/plain/BOOST_MPL_PREPROCESSED_HEADER \
/**/
#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(700))
# define AUX778076_INCLUDE_STRING BOOST_PP_STRINGIZE(boost/mpl/list/AUX778076_HEADER)
# include AUX778076_INCLUDE_STRING
# undef AUX778076_INCLUDE_STRING
#else
# include BOOST_PP_STRINGIZE(boost/mpl/list/AUX778076_HEADER)
#endif
# undef AUX778076_HEADER
#undef BOOST_MPL_PREPROCESSED_HEADER
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,52 @@
/* Copyright 2003-2015 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* See http://www.boost.org/libs/multi_index for library home page.
*/
#ifndef BOOST_MULTI_INDEX_DETAIL_RAW_PTR_HPP
#define BOOST_MULTI_INDEX_DETAIL_RAW_PTR_HPP
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <boost/mpl/bool.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost{
namespace multi_index{
namespace detail{
/* gets the underlying pointer of a pointer-like value */
template<typename RawPointer>
inline RawPointer raw_ptr(RawPointer const& p,mpl::true_)
{
return p;
}
template<typename RawPointer,typename Pointer>
inline RawPointer raw_ptr(Pointer const& p,mpl::false_)
{
return p==Pointer(0)?0:&*p;
}
template<typename RawPointer,typename Pointer>
inline RawPointer raw_ptr(Pointer const& p)
{
return raw_ptr<RawPointer>(p,is_same<RawPointer,Pointer>());
}
} /* namespace multi_index::detail */
} /* namespace multi_index */
} /* namespace boost */
#endif
@@ -0,0 +1,61 @@
// Status=review
.Main Window:
- Select *FT8* on the *Mode* menu.
- Set Tx and Rx frequencies to 1200 Hz.
- Double-click on *Erase* to clear both text windows.
.Wide Graph Settings:
- *Bins/Pixel* = 4, *Start* = 200 Hz, *N Avg* = 2
- Adjust the width of the Wide Graph window so that the upper
frequency limit is approximately 2600 Hz.
.Open a Wave File:
- Select *File | Open* and navigate to
+...\save\samples\FT8\170709_135615.wav+. The waterfall and decoded
text window should look something like the following screen shots:
[[X15]]
image::170709_135615.wav.png[align="left",alt="Wide Graph Decode 170709_135615"]
image::ft8_decodes.png[align="left"]
- Click with the mouse anywhere on the waterfall display. The green Rx
frequency marker will jump to your selected frequency, and the Rx
frequency control on the main window will be updated accordingly.
- Do the same thing with the Shift key held down. Now the red Tx
frequency marker and its associated control on the main window will
follow your frequency selections.
- Do the same thing with the Ctrl key held down. Now the both colored
markers and both spinner controls will follow your selections.
- Double-clicking at any frequency on the waterfall does all the
things just described and also invokes the decoder in a small range
around that frequency. To decode a particular signal, double-click
near the left edge of its waterfall trace.
- Now double-click on any of the the lines of decoded text in the main
window. Unless you have *My Call* set to K1JT or KY7M on the
*Settings -> General* tab, all three lines will show the same
behavior, setting both RxFreq and TxFreq to the frequency of the
selected message. However, if MyCall is set to K1JT then clicking on
a message directed to K1JT will move only the Rx frequency setting.
This behavior is desirable so that you will not inadvertently change
your Tx frequency to that of a tail-ender who called you somewhere
else in the FT8 subband.
NOTE: The FT8 decoder can often copy several overlapping signals at
nearly the same frequency. However, in crowded band conditions you
will often find it advantageous to move off the frequency of the
station you are calling. Keyboard shortcuts *Shift+F11* and
*Shift+F12* provide an easy way to move your Tx frequency in 60 Hz
steps.
NOTE: Further helpful tips on FT8 operating procedures are available
{ft8_tips}. Thanks to ZL2IFB!
IMPORTANT: When finished with this Tutorial, don't forget to re-enter
your own callsign as *My Call* on the *Settings | General* tab.
@@ -0,0 +1,212 @@
//
// Copyright (c) 2000-2002
// Joerg Walter, Mathias Koch
//
// 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)
//
// The authors gratefully acknowledge the support of
// GeNeSys mbH & Co. KG in producing this work.
//
#ifndef _BOOST_UBLAS_DEFINITIONS_
#define _BOOST_UBLAS_DEFINITIONS_
namespace boost { namespace numeric { namespace ublas {
namespace detail {
/* Borrowed from boost/concept_checks.hpp
"inline" is used for ignore_unused_variable_warning()
to make sure there is no overhead with g++.
*/
template <class T> inline
void ignore_unused_variable_warning(const T&) {}
} // namespace detail
// Borrowed from Dave Abraham's noncopyable.
// I believe this should be part of utility.hpp one day...
namespace nonassignable_ // protection from unintended ADL
{
class nonassignable {
protected:
nonassignable () {}
~nonassignable () {}
private: // emphasize the following members are private
const nonassignable& operator= (const nonassignable &);
}; // nonassignable
}
typedef nonassignable_::nonassignable nonassignable;
// Assignment proxy.
// Provides temporary free assigment when LHS has no alias on RHS
template<class C>
class noalias_proxy:
private nonassignable {
public:
typedef typename C::closure_type closure_type;
BOOST_UBLAS_INLINE
noalias_proxy (C& lval):
nonassignable (), lval_ (lval) {}
BOOST_UBLAS_INLINE
noalias_proxy (const noalias_proxy& p):
nonassignable (), lval_ (p.lval_) {}
template <class E>
BOOST_UBLAS_INLINE
closure_type &operator= (const E& e) {
lval_.assign (e);
return lval_;
}
template <class E>
BOOST_UBLAS_INLINE
closure_type &operator+= (const E& e) {
lval_.plus_assign (e);
return lval_;
}
template <class E>
BOOST_UBLAS_INLINE
closure_type &operator-= (const E& e) {
lval_.minus_assign (e);
return lval_;
}
private:
closure_type lval_;
};
// Improve syntax of efficient assignment where no aliases of LHS appear on the RHS
// noalias(lhs) = rhs_expression
template <class C>
BOOST_UBLAS_INLINE
noalias_proxy<C> noalias (C& lvalue) {
return noalias_proxy<C> (lvalue);
}
template <class C>
BOOST_UBLAS_INLINE
noalias_proxy<const C> noalias (const C& lvalue) {
return noalias_proxy<const C> (lvalue);
}
// Possible future compatible syntax where lvalue possible has an unsafe alias on the RHS
// safe(lhs) = rhs_expression
template <class C>
BOOST_UBLAS_INLINE
C& safe (C& lvalue) {
return lvalue;
}
template <class C>
BOOST_UBLAS_INLINE
const C& safe (const C& lvalue) {
return lvalue;
}
// Dimension accessors
namespace dimension {
// Generic accessors
template<unsigned dimension>
struct dimension_properties {};
template<>
struct dimension_properties<1> {
template <class E>
BOOST_UBLAS_INLINE static
typename E::size_type size (const vector_expression<E> &e) {
return e ().size ();
}
template <class E>
BOOST_UBLAS_INLINE static
typename E::size_type size (const matrix_expression<E> &e) {
return e ().size1 ();
}
// Note: Index functions cannot deduce dependant template parameter V or M from i
template <class V>
BOOST_UBLAS_INLINE static
typename V::size_type index (const typename V::iterator &i) {
return i.index ();
}
template <class M>
BOOST_UBLAS_INLINE static
typename M::size_type index (const typename M::iterator1 &i) {
return i.index1 ();
}
template <class M>
BOOST_UBLAS_INLINE static
typename M::size_type index (const typename M::iterator2 &i) {
return i.index1 ();
}
};
template<>
struct dimension_properties<2> {
template <class E>
BOOST_UBLAS_INLINE static
typename E::size_type size (const vector_expression<E> &) {
return 1;
}
template <class E>
BOOST_UBLAS_INLINE static
typename E::size_type size (const matrix_expression<E> &e) {
return e ().size2 ();
}
template <class V>
BOOST_UBLAS_INLINE static
typename V::size_type index (const typename V::iterator &) {
return 1;
}
template <class M>
BOOST_UBLAS_INLINE static
typename M::size_type index (const typename M::iterator1 &i) {
return i.index2 ();
}
template <class M>
BOOST_UBLAS_INLINE static
typename M::size_type index (const typename M::iterator2 &i) {
return i.index2 ();
}
};
template<unsigned dimension, class E>
BOOST_UBLAS_INLINE
typename E::size_type size (const E& e) {
return dimension_properties<dimension>::size (e);
}
template<unsigned dimension, class I>
BOOST_UBLAS_INLINE
typename I::container_type::size_type
index (const I& i) {
typedef typename I::container_type container_type;
return dimension_properties<dimension>::template index<container_type> (i);
}
// Named accessors - just syntactic sugar
template<class V>
typename V::size_type num_elements (const V &v) {
return v.size ();
}
template<class M>
typename M::size_type num_rows (const M &m) {
return m.size1 ();
}
template<class M>
typename M::size_type num_columns (const M &m) {
return m.size2 ();
}
template<class MV>
typename MV::size_type num_non_zeros (const MV &mv) {
return mv.non_zeros ();
}
}
}}}
#endif