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,18 @@
// (C) Copyright John Maddock 2011.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for most recent version.
// SGI Irix specific config options:
#define BOOST_PLATFORM "Cray"
// boilerplate code:
#define BOOST_HAS_UNISTD_H
#include <boost/config/posix_features.hpp>
@@ -0,0 +1,28 @@
# /* **************************************************************************
# * *
# * (C) Copyright Paul Mensonides 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)
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# ifndef BOOST_PREPROCESSOR_SEQ_INSERT_HPP
# define BOOST_PREPROCESSOR_SEQ_INSERT_HPP
#
# include <boost/preprocessor/config/config.hpp>
# include <boost/preprocessor/seq/first_n.hpp>
# include <boost/preprocessor/seq/rest_n.hpp>
#
# /* BOOST_PP_SEQ_INSERT */
#
# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
# define BOOST_PP_SEQ_INSERT(seq, i, elem) BOOST_PP_SEQ_FIRST_N(i, seq) (elem) BOOST_PP_SEQ_REST_N(i, seq)
# else
# define BOOST_PP_SEQ_INSERT(seq, i, elem) BOOST_PP_SEQ_INSERT_I(seq, i, elem)
# define BOOST_PP_SEQ_INSERT_I(seq, i, elem) BOOST_PP_SEQ_FIRST_N(i, seq) (elem) BOOST_PP_SEQ_REST_N(i, seq)
# endif
#
# endif
@@ -0,0 +1,26 @@
// (C) Copyright John Maddock and Steve Cleary 2000.
// Use, modification and distribution are subject to the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt).
//
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
//
// macros and helpers for working with integral-constant-expressions.
#ifndef BOOST_TT_DETAIL_YES_NO_TYPE_HPP_INCLUDED
#define BOOST_TT_DETAIL_YES_NO_TYPE_HPP_INCLUDED
namespace boost {
namespace type_traits {
typedef char yes_type;
struct no_type
{
char padding[8];
};
} // namespace type_traits
} // namespace boost
#endif // BOOST_TT_DETAIL_YES_NO_TYPE_HPP_INCLUDED
@@ -0,0 +1,222 @@
subroutine ft8b(dd0,nfqso,f1,xdt,nharderrors,dmin,nbadcrc,message,xsnr)
use timer_module, only: timer
include 'ft8_params.f90'
parameter(NRECENT=10,NP2=2812)
character message*22,msgsent*22
character*12 recent_calls(NRECENT)
real a(5)
real s1(0:7,ND),s2(0:7,NN)
real ps(0:7)
real rxdata(3*ND),llr(3*ND) !Soft symbols
real dd0(15*12000)
integer*1 decoded(KK),apmask(3*ND),cw(3*ND)
integer itone(NN)
integer icos7(0:6)
complex cd0(NP2)
complex csync(0:6,32)
complex ctwk(32)
complex csymb(32)
logical first
data icos7/2,5,6,0,4,1,3/
data first/.true./
save first,twopi,fs2,dt2,taus,baud,csync
if( first ) then
twopi=8.0*atan(1.0)
fs2=12000.0/64.0
dt2=1/fs2
taus=32*dt2
baud=1/taus
do i=0,6
phi=0.0
dphi=twopi*icos7(i)*baud*dt2
do j=1,32
csync(i,j)=cmplx(cos(phi),sin(phi))
phi=mod(phi+dphi,twopi)
enddo
enddo
first=.false.
endif
max_iterations=40
norder=2
! if(abs(nfqso-f1).lt.10.0) norder=3
call timer('ft8_down',0)
call ft8_downsample(dd0,f1,cd0)
call timer('ft8_down',1)
i0=xdt*fs2
smax=0.0
do idt=i0-16,i0+16
sync=0
do i=0,6
i1=idt+i*32
i2=i1+36*32
i3=i1+72*32
term1=0.0 ! this needs to be fixed...
term2=0.0
term3=0.0
if( i1.ge.1 .and. i1+31.le.NP2 ) &
term1=abs(sum(cd0(i1:i1+31)*conjg(csync(i,1:32))))
if( i2.ge.1 .and. i2+31.le.NP2 ) &
term2=abs(sum(cd0(i2:i2+31)*conjg(csync(i,1:32))))
if( i3.ge.1 .and. i3+31.le.NP2 ) &
term3=abs(sum(cd0(i3:i3+31)*conjg(csync(i,1:32))))
sync=sync+term1+term2+term3
enddo
if( sync .gt. smax ) then
smax=sync
ibest=idt
endif
enddo
xdt2=ibest*dt2
! peak up the frequency
i0=xdt2*fs2
smax=0.0
do ifr=-5,5
delf=ifr*0.5
dphi=twopi*delf*dt2
phi=0.0
do i=1,32
ctwk(i)=cmplx(cos(phi),sin(phi))
phi=mod(phi+dphi,twopi)
enddo
sync=0.0
do i=0,6
i1=i0+i*32
i2=i1+36*32
i3=i1+72*32
term1=0.0 ! this needs to be fixed...
term2=0.0
term3=0.0
if( i1.ge.1 .and. i1+31.le.NP2 ) &
term1=abs(sum(cd0(i1:i1+31)*conjg(ctwk*csync(i,1:32))))
if( i2.ge.1 .and. i2+31.le.NP2 ) &
term2=abs(sum(cd0(i2:i2+31)*conjg(ctwk*csync(i,1:32))))
if( i3.ge.1 .and. i3+31.le.NP2 ) &
term3=abs(sum(cd0(i3:i3+31)*conjg(ctwk*csync(i,1:32))))
sync=sync+term1+term2+term3
enddo
if( sync .gt. smax ) then
smax=sync
delfbest=delf
endif
enddo
a=0.0
a(1)=-delfbest
call twkfreq1(cd0,NP2,fs2,a,cd0)
xdt=xdt2
f1=f1+delfbest
j=0
do k=1,NN
i1=ibest+(k-1)*32
csymb=cmplx(0.0,0.0)
if( i1.ge.1 .and. i1+31 .le. NP2 ) csymb=cd0(i1:i1+31)
call four2a(csymb,32,1,-1,1)
s2(0:7,k)=abs(csymb(1:8))
enddo
j=0
do k=1,NN
if(k.le.7) cycle
if(k.ge.37 .and. k.le.43) cycle
if(k.gt.72) cycle
j=j+1
s1(0:7,j)=s2(0:7,k)
enddo
do j=1,ND
ps=s1(0:7,j)
where (ps.gt.0.0) ps=log(ps)
r1=max(ps(1),ps(3),ps(5),ps(7))-max(ps(0),ps(2),ps(4),ps(6))
r2=max(ps(2),ps(3),ps(6),ps(7))-max(ps(0),ps(1),ps(4),ps(5))
r4=max(ps(4),ps(5),ps(6),ps(7))-max(ps(0),ps(1),ps(2),ps(3))
rxdata(3*j-2)=r4
rxdata(3*j-1)=r2
rxdata(3*j)=r1
enddo
rxav=sum(rxdata)/(3.0*ND)
rx2av=sum(rxdata*rxdata)/(3.0*ND)
var=rx2av-rxav*rxav
if( var .gt. 0.0 ) then
rxsig=sqrt(var)
else
rxsig=sqrt(rx2av)
endif
rxdata=rxdata/rxsig
ss=0.84
llr=2.0*rxdata/(ss*ss)
apmask=0
cw=0
call timer('bpd174 ',0)
call bpdecode174(llr,apmask,max_iterations,decoded,cw,nharderrors)
call timer('bpd174 ',1)
dmin=0.0
if(nharderrors.lt.0) then
call timer('osd174 ',0)
call osd174(llr,norder,decoded,cw,nharderrors,dmin)
call timer('osd174 ',1)
endif
nbadcrc=1
message=' '
xsnr=-99.0
if(count(cw.eq.0).eq.174) go to 900 !Reject the all-zero codeword
if( nharderrors.ge.0 .and. dmin.le.30.0 .and. nharderrors .lt. 30) then
call chkcrc12a(decoded,nbadcrc)
else
nharderrors=-1
go to 900
endif
if(nbadcrc.eq.0) then
call extractmessage174(decoded,message,ncrcflag,recent_calls,nrecent)
call genft8(message,msgsent,itone)
xsig=0.0
xnoi=0.0
do i=1,79
xsig=xsig+s2(itone(i),i)**2
ios=mod(itone(i)+4,7)
xnoi=xnoi+s2(ios,i)**2
enddo
xsnr=0.001
if( xnoi.gt.0 .and. xnoi.lt.xsig ) xsnr=xsig/xnoi-1.0
xsnr=10.0*log10(xsnr)-27.0
if( xsnr .lt. -24.0 ) xsnr=-24.0
endif
900 continue
return
end subroutine ft8b
subroutine ft8_downsample(dd,f0,c1)
! Downconvert to complex data sampled at 187.5 Hz, 32 samples/symbol
parameter (NMAX=15*12000,NFFT2=2812)
complex c1(0:NFFT2-1)
complex cx(0:NMAX/2-1)
real dd(NMAX),x(NMAX)
equivalence (x,cx)
save x
df=12000.0/NMAX
x=dd
call four2a(x,NMAX,1,-1,0) !r2c FFT to freq domain
baud=12000.0/(32.0*64.0)
i0=nint(f0/df)
ft=f0+8.0*baud
it=min(nint(ft/df),NMAX/2-1)
fb=f0-1.0*baud
ib=max(1,nint(fb/df))
k=0
c1=cmplx(0.0,0.0)
do i=ib,it
c1(k)=cx(i)
k=k+1
enddo
c1=cshift(c1,i0-ib)
call four2a(c1,NFFT2,1,1,1) !c2c FFT back to time domain
c1=c1/(NMAX*NFFT2)
return
end subroutine ft8_downsample
@@ -0,0 +1,21 @@
subroutine ana932(dat,npts0,cdat,npts)
real dat(npts0)
complex cdat(262145)
n=log(float(npts0))/log(2.0)
nfft1=2**(n+1)
nfft2=9*nfft1/32
df932=11025.0/nfft1
fac=2.0/nfft1
do i=1,npts0/2
cdat(i)=fac*cmplx(dat(2*i-1),dat(2*i))
enddo
cdat(npts0/2+1:nfft1/2)=0.
call four2a(cdat,nfft1,1,-1,0) !Forward r2c FFT
call four2a(cdat,nfft2,1,1,1) !Inverse c2c FFT
npts=npts0*9.0/32.0 !Downsampled data length
npts2=npts
return
end subroutine ana932
@@ -0,0 +1,145 @@
parameter (MAXTEST=75,NTEST=68)
character*22 testmsg(MAXTEST)
character*22 testmsgchk(MAXTEST)
! Test msgs should include the extremes for the different types
! See pfx.f90
! Type 1 P & A
! Type 1 1A & E5
data testmsg(1:NTEST)/ &
"CQ WB9XYZ EN34", &
"CQ DX WB9XYZ EN34", &
"QRZ WB9XYZ EN34", &
"KA1ABC WB9XYZ EN34", &
"KA1ABC WB9XYZ RO", &
"KA1ABC WB9XYZ -21", &
"KA1ABC WB9XYZ R-19", &
"KA1ABC WB9XYZ RRR", &
"KA1ABC WB9XYZ 73", &
"KA1ABC WB9XYZ", &
"CQ 000 WB9XYZ EN34", &
"CQ 999 WB9XYZ EN34", &
"CQ EU WB9XYZ EN34", &
"CQ WY WB9XYZ EN34", &
"1A/KA1ABC WB9XYZ", &
"E5/KA1ABC WB9XYZ", &
"KA1ABC 1A/WB9XYZ", &
"KA1ABC E5/WB9XYZ", &
"KA1ABC/P WB9XYZ", &
"KA1ABC/A WB9XYZ", &
"KA1ABC WB9XYZ/P", &
"KA1ABC WB9XYZ/A", &
"CQ KA1ABC/P", &
"CQ WB9XYZ/A", &
"QRZ KA1ABC/P", &
"QRZ WB9XYZ/A", &
"DE KA1ABC/P", &
"DE WB9XYZ/A", &
"CQ 1A/KA1ABC", &
"CQ E5/KA1ABC", &
"DE 1A/KA1ABC", &
"DE E5/KA1ABC", &
"QRZ 1A/KA1ABC", &
"QRZ E5/KA1ABC", &
"CQ WB9XYZ/1A", &
"CQ WB9XYZ/E5", &
"QRZ WB9XYZ/1A", &
"QRZ WB9XYZ/E5", &
"DE WB9XYZ/1A", &
"DE WB9XYZ/E5", &
"CQ A000/KA1ABC FM07", &
"CQ ZZZZ/KA1ABC FM07", &
"QRZ W4/KA1ABC FM07", &
"DE W4/KA1ABC FM07", &
"CQ W4/KA1ABC -22", &
"DE W4/KA1ABC -22", &
"QRZ W4/KA1ABC -22", &
"CQ W4/KA1ABC R-22", &
"DE W4/KA1ABC R-22", &
"QRZ W4/KA1ABC R-22", &
"DE W4/KA1ABC 73", &
"CQ KA1ABC FM07", &
"QRZ KA1ABC FM07", &
"DE KA1ABC/VE6 FM07", &
"CQ KA1ABC/VE6 -22", &
"DE KA1ABC/VE6 -22", &
"QRZ KA1ABC/VE6 -22", &
"CQ KA1ABC/VE6 R-22", &
"DE KA1ABC/VE6 R-22", &
"QRZ KA1ABC/VE6 R-22", &
"DE KA1ABC 73", &
"HELLO WORLD", &
"ZL4/KA1ABC 73", &
"KA1ABC XL/WB9XYZ", &
"KA1ABC WB9XYZ/W4", &
"DE KA1ABC/QRP 2W", &
"KA1ABC/1 WB9XYZ/1", &
"123456789ABCDEFGH"/
data testmsgchk(1:NTEST)/ &
"CQ WB9XYZ EN34", &
"CQ DX WB9XYZ EN34", &
"QRZ WB9XYZ EN34", &
"KA1ABC WB9XYZ EN34", &
"KA1ABC WB9XYZ RO", &
"KA1ABC WB9XYZ -21", &
"KA1ABC WB9XYZ R-19", &
"KA1ABC WB9XYZ RRR", &
"KA1ABC WB9XYZ 73", &
"KA1ABC WB9XYZ", &
"CQ 000 WB9XYZ EN34", &
"CQ 999 WB9XYZ EN34", &
"CQ EU WB9XYZ EN34", &
"CQ WY WB9XYZ EN34", &
"1A/KA1ABC WB9XYZ", &
"E5/KA1ABC WB9XYZ", &
"KA1ABC 1A/WB9XYZ", &
"KA1ABC E5/WB9XYZ", &
"KA1ABC/P WB9XYZ", &
"KA1ABC/A WB9XYZ", &
"KA1ABC WB9XYZ/P", &
"KA1ABC WB9XYZ/A", &
"CQ KA1ABC/P", &
"CQ WB9XYZ/A", &
"QRZ KA1ABC/P", &
"QRZ WB9XYZ/A", &
"DE KA1ABC/P", &
"DE WB9XYZ/A", &
"CQ 1A/KA1ABC", &
"CQ E5/KA1ABC", &
"DE 1A/KA1ABC", &
"DE E5/KA1ABC", &
"QRZ 1A/KA1ABC", &
"QRZ E5/KA1ABC", &
"CQ WB9XYZ/1A", &
"CQ WB9XYZ/E5", &
"QRZ WB9XYZ/1A", &
"QRZ WB9XYZ/E5", &
"DE WB9XYZ/1A", &
"DE WB9XYZ/E5", &
"CQ A000/KA1ABC FM07", &
"CQ ZZZZ/KA1ABC FM07", &
"QRZ W4/KA1ABC FM07", &
"DE W4/KA1ABC FM07", &
"CQ W4/KA1ABC -22", &
"DE W4/KA1ABC -22", &
"QRZ W4/KA1ABC -22", &
"CQ W4/KA1ABC R-22", &
"DE W4/KA1ABC R-22", &
"QRZ W4/KA1ABC R-22", &
"DE W4/KA1ABC 73", &
"CQ KA1ABC FM07", &
"QRZ KA1ABC FM07", &
"DE KA1ABC/VE6 FM07", &
"CQ KA1ABC/VE6 -22", &
"DE KA1ABC/VE6 -22", &
"QRZ KA1ABC/VE6 -22", &
"CQ KA1ABC/VE6 R-22", &
"DE KA1ABC/VE6 R-22", &
"QRZ KA1ABC/VE6 R-22", &
"DE KA1ABC 73", &
"HELLO WORLD", &
"ZL4/KA1ABC 73", &
"KA1ABC XL/WB9", &
"KA1ABC WB9XYZ", &
"DE KA1ABC/QRP", &
"KA1ABC/1 WB9X", &
"123456789ABCD"/
@@ -0,0 +1,17 @@
/*==============================================================================
Copyright (c) 2005-2010 Joel de Guzman
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_SCOPE_HPP
#define BOOST_PHOENIX_SCOPE_HPP
#include <boost/phoenix/version.hpp>
#include <boost/phoenix/scope/scoped_environment.hpp>
#include <boost/phoenix/scope/lambda.hpp>
#include <boost/phoenix/scope/let.hpp>
#include <boost/phoenix/scope/local_variable.hpp>
#endif
@@ -0,0 +1,16 @@
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
// abi_prefix.hpp
// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for updates, documentation, and revision history.
#include <boost/config/abi_prefix.hpp> // must be the last header
#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable : 4251 4231 4660 4275)
#endif
@@ -0,0 +1,42 @@
// boost/system/api_config.hpp -------------------------------------------------------//
// Copyright Beman Dawes 2003, 2006, 2010
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See http://www.boost.org/libs/system for documentation.
//--------------------------------------------------------------------------------------//
// Boost.System calls operating system API functions to implement system error category
// functions. Usually there is no question as to which API is to be used.
//
// In the case of MinGW or Cygwin/MinGW, however, both POSIX and Windows API's are
// available. Chaos ensues if other code thinks one is in use when Boost.System was
// actually built with the other. This header centralizes the API choice and prevents
// user definition of API macros, thus elminating the possibility of mismatches and the
// need to test configurations with little or no practical value.
//
//--------------------------------------------------------------------------------------//
#ifndef BOOST_SYSTEM_API_CONFIG_HPP
#define BOOST_SYSTEM_API_CONFIG_HPP
# if defined(BOOST_POSIX_API) || defined(BOOST_WINDOWS_API)
# error user defined BOOST_POSIX_API or BOOST_WINDOWS_API not supported
# endif
// BOOST_POSIX_API or BOOST_WINDOWS_API specify which API to use
// Cygwin/MinGW does not predefine _WIN32.
// Standalone MinGW and all other known Windows compilers do predefine _WIN32
// Compilers that predefine _WIN32 or __MINGW32__ do so for Windows 64-bit builds too.
# if defined(_WIN32) || defined(__CYGWIN__) // Windows default, including MinGW and Cygwin
# define BOOST_WINDOWS_API
# else
# define BOOST_POSIX_API
# endif
#endif // BOOST_SYSTEM_API_CONFIG_HPP
@@ -0,0 +1,99 @@
# /* **************************************************************************
# * *
# * (C) Copyright Paul Mensonides 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)
# * *
# ************************************************************************** */
#
# /* See http://www.boost.org for most recent version. */
#
# include <boost/preprocessor/slot/detail/shared.hpp>
#
# undef BOOST_PP_LOCAL_FE
#
# undef BOOST_PP_LOCAL_FE_DIGIT_1
# undef BOOST_PP_LOCAL_FE_DIGIT_2
# undef BOOST_PP_LOCAL_FE_DIGIT_3
# undef BOOST_PP_LOCAL_FE_DIGIT_4
# undef BOOST_PP_LOCAL_FE_DIGIT_5
# undef BOOST_PP_LOCAL_FE_DIGIT_6
# undef BOOST_PP_LOCAL_FE_DIGIT_7
# undef BOOST_PP_LOCAL_FE_DIGIT_8
# undef BOOST_PP_LOCAL_FE_DIGIT_9
# undef BOOST_PP_LOCAL_FE_DIGIT_10
#
# if BOOST_PP_SLOT_TEMP_3 == 0
# define BOOST_PP_LOCAL_FE_DIGIT_3 0
# elif BOOST_PP_SLOT_TEMP_3 == 1
# define BOOST_PP_LOCAL_FE_DIGIT_3 1
# elif BOOST_PP_SLOT_TEMP_3 == 2
# define BOOST_PP_LOCAL_FE_DIGIT_3 2
# elif BOOST_PP_SLOT_TEMP_3 == 3
# define BOOST_PP_LOCAL_FE_DIGIT_3 3
# elif BOOST_PP_SLOT_TEMP_3 == 4
# define BOOST_PP_LOCAL_FE_DIGIT_3 4
# elif BOOST_PP_SLOT_TEMP_3 == 5
# define BOOST_PP_LOCAL_FE_DIGIT_3 5
# elif BOOST_PP_SLOT_TEMP_3 == 6
# define BOOST_PP_LOCAL_FE_DIGIT_3 6
# elif BOOST_PP_SLOT_TEMP_3 == 7
# define BOOST_PP_LOCAL_FE_DIGIT_3 7
# elif BOOST_PP_SLOT_TEMP_3 == 8
# define BOOST_PP_LOCAL_FE_DIGIT_3 8
# elif BOOST_PP_SLOT_TEMP_3 == 9
# define BOOST_PP_LOCAL_FE_DIGIT_3 9
# endif
#
# if BOOST_PP_SLOT_TEMP_2 == 0
# define BOOST_PP_LOCAL_FE_DIGIT_2 0
# elif BOOST_PP_SLOT_TEMP_2 == 1
# define BOOST_PP_LOCAL_FE_DIGIT_2 1
# elif BOOST_PP_SLOT_TEMP_2 == 2
# define BOOST_PP_LOCAL_FE_DIGIT_2 2
# elif BOOST_PP_SLOT_TEMP_2 == 3
# define BOOST_PP_LOCAL_FE_DIGIT_2 3
# elif BOOST_PP_SLOT_TEMP_2 == 4
# define BOOST_PP_LOCAL_FE_DIGIT_2 4
# elif BOOST_PP_SLOT_TEMP_2 == 5
# define BOOST_PP_LOCAL_FE_DIGIT_2 5
# elif BOOST_PP_SLOT_TEMP_2 == 6
# define BOOST_PP_LOCAL_FE_DIGIT_2 6
# elif BOOST_PP_SLOT_TEMP_2 == 7
# define BOOST_PP_LOCAL_FE_DIGIT_2 7
# elif BOOST_PP_SLOT_TEMP_2 == 8
# define BOOST_PP_LOCAL_FE_DIGIT_2 8
# elif BOOST_PP_SLOT_TEMP_2 == 9
# define BOOST_PP_LOCAL_FE_DIGIT_2 9
# endif
#
# if BOOST_PP_SLOT_TEMP_1 == 0
# define BOOST_PP_LOCAL_FE_DIGIT_1 0
# elif BOOST_PP_SLOT_TEMP_1 == 1
# define BOOST_PP_LOCAL_FE_DIGIT_1 1
# elif BOOST_PP_SLOT_TEMP_1 == 2
# define BOOST_PP_LOCAL_FE_DIGIT_1 2
# elif BOOST_PP_SLOT_TEMP_1 == 3
# define BOOST_PP_LOCAL_FE_DIGIT_1 3
# elif BOOST_PP_SLOT_TEMP_1 == 4
# define BOOST_PP_LOCAL_FE_DIGIT_1 4
# elif BOOST_PP_SLOT_TEMP_1 == 5
# define BOOST_PP_LOCAL_FE_DIGIT_1 5
# elif BOOST_PP_SLOT_TEMP_1 == 6
# define BOOST_PP_LOCAL_FE_DIGIT_1 6
# elif BOOST_PP_SLOT_TEMP_1 == 7
# define BOOST_PP_LOCAL_FE_DIGIT_1 7
# elif BOOST_PP_SLOT_TEMP_1 == 8
# define BOOST_PP_LOCAL_FE_DIGIT_1 8
# elif BOOST_PP_SLOT_TEMP_1 == 9
# define BOOST_PP_LOCAL_FE_DIGIT_1 9
# endif
#
# if BOOST_PP_LOCAL_FE_DIGIT_3
# define BOOST_PP_LOCAL_FE() BOOST_PP_SLOT_CC_3(BOOST_PP_LOCAL_FE_DIGIT_3, BOOST_PP_LOCAL_FE_DIGIT_2, BOOST_PP_LOCAL_FE_DIGIT_1)
# elif BOOST_PP_LOCAL_FE_DIGIT_2
# define BOOST_PP_LOCAL_FE() BOOST_PP_SLOT_CC_2(BOOST_PP_LOCAL_FE_DIGIT_2, BOOST_PP_LOCAL_FE_DIGIT_1)
# else
# define BOOST_PP_LOCAL_FE() BOOST_PP_LOCAL_FE_DIGIT_1
# endif
@@ -0,0 +1,93 @@
// Copyright Aleksey Gurtovoy 2000-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/integral_c_tag.hpp>
#include <boost/mpl/aux_/static_cast.hpp>
#include <boost/mpl/aux_/nttp_decl.hpp>
#include <boost/mpl/aux_/config/static_constant.hpp>
#include <boost/mpl/aux_/config/workaround.hpp>
#include <boost/preprocessor/cat.hpp>
#if !defined(AUX_WRAPPER_NAME)
# define AUX_WRAPPER_NAME BOOST_PP_CAT(AUX_WRAPPER_VALUE_TYPE,_)
#endif
#if !defined(AUX_WRAPPER_PARAMS)
# define AUX_WRAPPER_PARAMS(N) BOOST_MPL_AUX_NTTP_DECL(AUX_WRAPPER_VALUE_TYPE, N)
#endif
#if !defined(AUX_WRAPPER_INST)
# if BOOST_WORKAROUND(__MWERKS__, <= 0x2407)
# define AUX_WRAPPER_INST(value) AUX_WRAPPER_NAME< value >
# else
# define AUX_WRAPPER_INST(value) BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE::AUX_WRAPPER_NAME< value >
# endif
#endif
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_OPEN
template< AUX_WRAPPER_PARAMS(N) >
struct AUX_WRAPPER_NAME
{
BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, value = N);
// agurt, 08/mar/03: SGI MIPSpro C++ workaround, have to #ifdef because some
// other compilers (e.g. MSVC) are not particulary happy about it
#if BOOST_WORKAROUND(__EDG_VERSION__, <= 238)
typedef struct AUX_WRAPPER_NAME type;
#else
typedef AUX_WRAPPER_NAME type;
#endif
typedef AUX_WRAPPER_VALUE_TYPE value_type;
typedef integral_c_tag tag;
// have to #ifdef here: some compilers don't like the 'N + 1' form (MSVC),
// while some other don't like 'value + 1' (Borland), and some don't like
// either
#if BOOST_WORKAROUND(__EDG_VERSION__, <= 243)
private:
BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, next_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)));
BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)));
public:
typedef AUX_WRAPPER_INST(next_value) next;
typedef AUX_WRAPPER_INST(prior_value) prior;
#elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \
|| BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \
|| (BOOST_WORKAROUND(__HP_aCC, <= 53800) && (BOOST_WORKAROUND(__hpxstd98, != 1)))
typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)) ) next;
typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)) ) prior;
#else
typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value + 1)) ) next;
typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior;
#endif
// enables uniform function call syntax for families of overloaded
// functions that return objects of both arithmetic ('int', 'long',
// 'double', etc.) and wrapped integral types (for an example, see
// "mpl/example/power.cpp")
BOOST_CONSTEXPR operator AUX_WRAPPER_VALUE_TYPE() const { return static_cast<AUX_WRAPPER_VALUE_TYPE>(this->value); }
};
#if !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)
template< AUX_WRAPPER_PARAMS(N) >
AUX_WRAPPER_VALUE_TYPE const AUX_WRAPPER_INST(N)::value;
#endif
BOOST_MPL_AUX_ADL_BARRIER_NAMESPACE_CLOSE
#undef AUX_WRAPPER_NAME
#undef AUX_WRAPPER_PARAMS
#undef AUX_WRAPPER_INST
#undef AUX_WRAPPER_VALUE_TYPE
@@ -0,0 +1,567 @@
/* RAND.C - Random number generation module. */
/* Copyright (c) 1995-2012 by Radford M. Neal.
*
* Permission is granted for anyone to copy, use, modify, and distribute
* these programs and accompanying documents for any purpose, provided
* this copyright notice is retained and prominently displayed, and note
* is made of any changes made to these programs. These programs and
* documents are distributed without any warranty, express or implied.
* As the programs were written for research purposes only, they have not
* been tested to the degree that would be advisable in any important
* application. All use of these programs is entirely at the user's own
* risk.
*/
/* Random generation routines at the end of this file are taken from the
GNU C library, see the copyright notice there. */
/* NOTE: See rand.html for documentation on these procedures. */
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include "rand.h"
static long int this_nrand48 (unsigned short int [3]);
/* Local version of nrand48 */
/* This module uses the 'this_nrand48' pseudo-random number generator from the
GNU C library, included below, but renamed to 'this_nrand48'. The
output of this generator is combined with a file of real random numbers.
Many of the methods used in this module may be found in the following
reference:
Devroye, L. (1986) Non-Uniform Random Variate Generation,
New York: Springer-Verlag.
The methods used here are not necessarily the fastest available. They're
selected to be reasonably fast while also being easy to write.
*/
/* CONSTANT PI. Defined here if not in <math.h>. */
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
/* TABLES OF REAL RANDOM NUMBERS. A file of 100000 real random numbers
(NOT pseudo-random) is used in conjunction with pseudo-random numbers
for extra insurance. These are employed in the form of five tables
of 5000 32-bit integers.
The file must be located at the path given by RAND_FILE, which should
be defined on the "cc" command line. */
#define Table_size 5000 /* Number of words in each table */
static int rn[N_tables][Table_size]; /* Random number tables */
/* STATE OF RANDOM NUMBER GENERATOR. */
static int initialized = 0; /* Has module been initialized? */
static rand_state state0; /* Default state structure */
static rand_state *state; /* Pointer to current state */
/* INITIALIZE MODULE. Sets things up using the default state structure,
set as if rand_seed had been called with a seed of one. */
static void initialize (void)
{
int i, j, k, w;
char b;
FILE *f;
if (!initialized)
{
f = fopen(RAND_FILE,"rb");
if (f==NULL)
{ fprintf(stderr,"Can't open file of random numbers (%s)\n",RAND_FILE);
exit(1);
}
for (i = 0; i<N_tables; i++)
{ for (j = 0; j<Table_size; j++)
{ w = 0;
for (k = 0; k<4; k++)
{ if (fread(&b,1,1,f)!=1)
{ fprintf(stderr,"Error reading file of random numbers (%s)\n",
RAND_FILE);
exit(1);
}
w = (w<<8) | (b&0xff);
}
rn[i][j] = w;
}
}
state = &state0;
initialized = 1;
rand_seed(1);
}
}
/* SET CURRENT STATE ACCORDING TO SEED. */
void rand_seed
( int seed
)
{
int j;
if (!initialized) initialize();
state->seed = seed;
state->state48[0] = seed>>16;
state->state48[1] = seed&0xffff;
state->state48[2] = rn[0][(seed&0x7fffffff)%Table_size];
for (j = 0; j<N_tables; j++)
{ state->ptr[j] = seed%Table_size;
seed /= Table_size;
}
}
/* SET STATE STRUCTURE TO USE. */
void rand_use_state
( rand_state *st
)
{
if (!initialized) initialize();
state = st;
}
/* RETURN POINTER TO CURRENT STATE. */
rand_state *rand_get_state (void)
{
if (!initialized) initialize();
return state;
}
/* GENERATE RANDOM 31-BIT INTEGER. Not really meant for use outside this
module. */
int rand_word(void)
{
int v;
int j;
if (!initialized) initialize();
v = this_nrand48(state->state48);
for (j = 0; j<N_tables; j++)
{ v ^= rn[j][state->ptr[j]];
}
for (j = 0; j<N_tables && state->ptr[j]==Table_size-1; j++)
{ state->ptr[j] = 0;
}
if (j<N_tables)
{ state->ptr[j] += 1;
}
return v & 0x7fffffff;
}
/* GENERATE UNIFORMLY FROM [0,1). */
double rand_uniform (void)
{
return (double)rand_word() / (1.0+(double)0x7fffffff);
}
/* GENERATE UNIFORMLY FORM (0,1). */
double rand_uniopen (void)
{
return (0.5+(double)rand_word()) / (1.0+(double)0x7fffffff);
}
/* GENERATE RANDOM INTEGER FROM 0, 1, ..., (n-1). */
int rand_int
( int n
)
{
return (int) (n * rand_uniform());
}
/* GENERATE INTEGER FROM 0, 1, ..., (n-1), WITH GIVEN DISTRIBUTION. */
int rand_pickd
( double *p,
int n
)
{
double t, r;
int i;
t = 0;
for (i = 0; i<n; i++)
{ if (p[i]<0) abort();
t += p[i];
}
if (t<=0) abort();
r = t * rand_uniform();
for (i = 0; i<n; i++)
{ r -= p[i];
if (r<0) return i;
}
/* Return value with non-zero probability if we get here due to roundoff. */
for (i = 0; i<n; i++)
{ if (p[i]>0) return i;
}
abort();
}
/* SAME PROCEDURE AS ABOVE, BUT WITH FLOAT ARGUMENT. */
int rand_pickf
( float *p,
int n
)
{
double t, r;
int i;
t = 0;
for (i = 0; i<n; i++)
{ if (p[i]<=0) abort();
t += p[i];
}
if (t<=0) abort();
r = t * rand_uniform();
for (i = 0; i<n; i++)
{ r -= p[i];
if (r<0) return i;
}
/* Return value with non-zero probability if we get here due to roundoff. */
for (i = 0; i<n; i++)
{ if (p[i]>0) return i;
}
abort();
}
/* GENERATE RANDOM PERMUTATION OF INTEGERS FROM 1 TO N. */
void rand_permutation
( int *perm, /* Place to store permutation */
int n /* Number of integers to permute */
)
{
int i, j, t;
for (i = 0; i<n; i++)
{ perm[i] = i+1;
}
for (i = 0; i<n; i++)
{ t = perm[i];
j = i + rand_int(n-i);
perm[i] = perm[j];
perm[j] = t;
}
}
/* POISSON GENERATOR. The method used is simple, but not very fast. See
Devroye, p. 503. Very large means are done using Gaussian approximation. */
int rand_poisson
( double lambda
)
{ int v;
if (lambda>10000)
{ v = (int) (lambda + rand_gaussian()*sqrt(lambda) + 0.5);
}
else
{ v = 0;
for (;;)
{ lambda -= rand_exp();
if (lambda<=0) break;
v += 1;
}
}
return v;
}
/* GAUSSIAN GENERATOR. Done by using the Box-Muller method, but only one
of the variates is retained (using both would require saving more state).
See Devroye, p. 235.
As written, should never deliver exactly zero, which may sometimes be
helpful. */
double rand_gaussian (void)
{
double a, b;
a = rand_uniform();
b = rand_uniopen();
return cos(2.0*M_PI*a) * sqrt(-2.0*log(b));
}
/* EXPONENTIAL GENERATOR. See Devroye, p. 29. Written so as to never
return exactly zero. */
double rand_exp (void)
{
return -log(rand_uniopen());
}
/* LOGISTIC GENERATOR. Just inverts the CDF. */
double rand_logistic (void)
{ double u;
u = rand_uniopen();
return log(u/(1-u));
}
/* CAUCHY GENERATOR. See Devroye, p. 29. */
double rand_cauchy (void)
{
return tan (M_PI * (rand_uniopen()-0.5));
}
/* GAMMA GENERATOR. Generates a positive real number, r, with density
proportional to r^(a-1) * exp(-r). See Devroye, p. 410 and p. 420.
Things are fiddled to avoid ever returning a value that is very near
zero. */
double rand_gamma
( double a
)
{
double b, c, X, Y, Z, U, V, W;
if (a<0.00001)
{ X = a;
}
else if (a<=1)
{
U = rand_uniopen();
X = rand_gamma(1+a) * pow(U,1/a);
}
else if (a<1.00001)
{ X = rand_exp();
}
else
{
b = a-1;
c = 3*a - 0.75;
for (;;)
{
U = rand_uniopen();
V = rand_uniopen();
W = U*(1-U);
Y = sqrt(c/W) * (U-0.5);
X = b+Y;
if (X>=0)
{
Z = 64*W*W*W*V*V;
if (Z <= 1 - 2*Y*Y/X || log(Z) <= 2 * (b*log(X/b) - Y)) break;
}
}
}
return X<1e-30 && X<a ? (a<1e-30 ? a : 1e-30) : X;
}
/* BETA GENERATOR. Generates a real number, r, in (0,1), with density
proportional to r^(a-1) * (1-r)^(b-1). Things are fiddled to avoid
the end-points, and to make the procedure symmetric between a and b. */
double rand_beta
( double a,
double b
)
{
double x, y, r;
do
{ x = rand_gamma(a);
y = rand_gamma(b);
r = 1.0 + x/(x+y);
r = r - 1.0;
} while (r<=0.0 || r>=1.0);
return r;
}
/* ROUTINES FROM THE GNU C LIBRARY. These were modified to extract
only the routines used here, and to allow them to be included in
this module without any possible name conflict with other modules.
Inclusion here ensures that these routines are always available, and
operate in exactly the same way on all systems. The routines as copied
below are still easily useable by other programs by simply inserting
this source code into an appropriate source file.
The following is the copyright notice for these routines:
Copyright (C) 1995, 1996, 1997, 2002 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
The GNU Lesser General Public License is included with these source
files in the file LGPL. */
#include <errno.h>
#include <limits.h>
#include <sys/types.h>
struct this_drand48_data
{
unsigned short int x[3]; /* Current state. */
unsigned short int old_x[3]; /* Old state. */
unsigned short int c; /* Additive const. in congruential formula. */
unsigned short int init; /* Flag for initializing. */
unsigned long long int a; /* Factor in congruential formula. */
};
/* Global state for non-reentrant functions. */
struct this_drand48_data libc_this_drand48_data;
static int this_nrand48_r (unsigned short int xsubi[3],
struct this_drand48_data *buffer,
long int *result);
/* Internal function to compute next state of the generator. */
static int this_drand48_iterate (unsigned short int xsubi[3],
struct this_drand48_data *buffer);
static long int this_nrand48 (xsubi)
unsigned short int xsubi[3];
{
long int result;
(void) this_nrand48_r (xsubi, &libc_this_drand48_data, &result);
return result;
}
static int this_nrand48_r (xsubi, buffer, result)
unsigned short int xsubi[3];
struct this_drand48_data *buffer;
long int *result;
{
/* Compute next state. */
if (this_drand48_iterate (xsubi, buffer) < 0)
return -1;
/* Store the result. */
if (sizeof (unsigned short int) == 2)
*result = xsubi[2] << 15 | xsubi[1] >> 1;
else
*result = xsubi[2] >> 1;
return 0;
}
static int this_drand48_iterate (xsubi, buffer)
unsigned short int xsubi[3];
struct this_drand48_data *buffer;
{
uint64_t X;
uint64_t result;
/* Initialize buffer, if not yet done. */
if (!buffer->init)
{
buffer->a = 0x5deece66dull;
buffer->c = 0xb;
buffer->init = 1;
}
/* Do the real work. We choose a data type which contains at least
48 bits. Because we compute the modulus it does not care how
many bits really are computed. */
X = (uint64_t) xsubi[2] << 32 | (uint32_t) xsubi[1] << 16 | xsubi[0];
result = X * buffer->a + buffer->c;
xsubi[0] = result & 0xffff;
xsubi[1] = (result >> 16) & 0xffff;
xsubi[2] = (result >> 32) & 0xffff;
return 0;
}
@@ -0,0 +1,107 @@
/* boost random/traits.hpp header file
*
* Copyright John Maddock 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)
*
* See http://www.boost.org for most recent version including documentation.
*
* These traits classes serve two purposes: they are designed to mostly
* work out of the box for multiprecision types (ie number types that are
* C++ class types and not integers or floats from type-traits point of view),
* they are also a potential point of specialization for user-defined
* number types.
*
* $Id$
*/
#ifndef BOOST_RANDOM_TRAITS_HPP
#define BOOST_RANDOM_TRAITS_HPP
#include <boost/type_traits/is_signed.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/make_unsigned.hpp>
#include <boost/mpl/bool.hpp>
#include <limits>
namespace boost {
namespace random {
namespace traits {
// \cond show_private
template <class T, bool intrinsic>
struct make_unsigned_imp
{
typedef typename boost::make_unsigned<T>::type type;
};
template <class T>
struct make_unsigned_imp<T, false>
{
BOOST_STATIC_ASSERT(std::numeric_limits<T>::is_specialized);
BOOST_STATIC_ASSERT(std::numeric_limits<T>::is_signed == false);
BOOST_STATIC_ASSERT(std::numeric_limits<T>::is_integer == true);
typedef T type;
};
// \endcond
/** \brief Converts the argument type T to an unsigned type.
*
* This trait has a single member `type` which is the unsigned type corresponding to T.
* Note that
* if T is signed, then member `type` *should define a type with one more bit precision than T*. For built-in
* types this trait defaults to `boost::make_unsigned<T>::type`. For user defined types it simply asserts that
* the argument type T is an unsigned integer (using std::numeric_limits).
* User defined specializations may be provided for other cases.
*/
template <class T>
struct make_unsigned
// \cond show_private
: public make_unsigned_imp < T, boost::is_integral<T>::value >
// \endcond
{};
// \cond show_private
template <class T, bool intrinsic>
struct make_unsigned_or_unbounded_imp
{
typedef typename boost::make_unsigned<T>::type type;
};
template <class T>
struct make_unsigned_or_unbounded_imp<T, false>
{
BOOST_STATIC_ASSERT(std::numeric_limits<T>::is_specialized);
BOOST_STATIC_ASSERT((std::numeric_limits<T>::is_signed == false) || (std::numeric_limits<T>::is_bounded == false));
BOOST_STATIC_ASSERT(std::numeric_limits<T>::is_integer == true);
typedef T type;
};
// \endcond
/** \brief Converts the argument type T to either an unsigned type or an unbounded integer type.
*
* This trait has a single member `type` which is either the unsigned type corresponding to T or an unbounded
* integer type. This trait is used to generate types suitable for the calculation of a range: as a result
* if T is signed, then member `type` *should define a type with one more bit precision than T*. For built-in
* types this trait defaults to `boost::make_unsigned<T>::type`. For user defined types it simply asserts that
* the argument type T is either an unbounded integer, or an unsigned one (using std::numeric_limits).
* User defined specializations may be provided for other cases.
*/
template <class T>
struct make_unsigned_or_unbounded
// \cond show_private
: public make_unsigned_or_unbounded_imp < T, boost::is_integral<T>::value >
// \endcond
{};
/** \brief Traits class that indicates whether type T is an integer
*/
template <class T>
struct is_integral
: public mpl::bool_<boost::is_integral<T>::value || (std::numeric_limits<T>::is_integer)>
{};
/** \brief Traits class that indicates whether type T is a signed integer
*/
template <class T> struct is_signed
: public mpl::bool_ < boost::is_signed<T>::value || (std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::is_integer && std::numeric_limits<T>::is_signed)>
{};
}
}
}
#endif
@@ -0,0 +1,72 @@
#if !defined(BOOST_PROTO_DONT_USE_PREPROCESSED_FILES)
#include <boost/proto/transform/detail/preprocessed/pack_impl.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/pack_impl.hpp")
#endif
///////////////////////////////////////////////////////////////////////////////
/// \file pack_impl.hpp
/// Contains helpers for pseudo-pack expansion.
//
// Copyright 2012 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, (0, BOOST_PP_DEC(BOOST_PROTO_MAX_ARITY), <boost/proto/transform/detail/pack_impl.hpp>))
#include BOOST_PP_ITERATE()
#if defined(__WAVE__) && defined(BOOST_PROTO_CREATE_PREPROCESSED_FILES)
#pragma wave option(output: null)
#endif
#else
#if BOOST_PP_ITERATION_DEPTH() == 1
#define N BOOST_PP_ITERATION()
#define M BOOST_PP_SUB(BOOST_PROTO_MAX_ARITY, N)
#define M0(Z, X, D) typename expand_pattern_helper<proto::_child_c<X>, Fun>::type
template<typename Fun, typename Cont>
struct expand_pattern<BOOST_PP_INC(N), Fun, Cont>
: Cont::template cat<BOOST_PP_ENUM(BOOST_PP_INC(N), M0, ~)>
{
BOOST_MPL_ASSERT_MSG(
(expand_pattern_helper<proto::_child_c<0>, Fun>::applied::value)
, NO_PACK_EXPRESSION_FOUND_IN_UNPACKING_PATTERN
, (Fun)
);
};
template<typename Ret BOOST_PP_ENUM_TRAILING_PARAMS(N, typename A)>
struct BOOST_PP_CAT(expand_pattern_rest_, N)
{
template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PP_INC(M), typename C, void)>
struct cat;
#define BOOST_PP_ITERATION_PARAMS_2 \
(3, (1, M, <boost/proto/transform/detail/pack_impl.hpp>))
#include BOOST_PP_ITERATE()
};
#undef M0
#undef M
#undef N
#else
#define I BOOST_PP_ITERATION()
#define J BOOST_PP_RELATIVE_ITERATION(1)
template<BOOST_PP_ENUM_PARAMS(I, typename C)>
struct cat<BOOST_PP_ENUM_PARAMS(I, C)>
{
typedef msvc_fun_workaround<Ret(BOOST_PP_ENUM_PARAMS(J, A) BOOST_PP_COMMA_IF(J) BOOST_PP_ENUM_PARAMS(I, C))> type;
};
#undef J
#undef I
#endif
#endif
@@ -0,0 +1,294 @@
// Copyright Kevlin Henney, 2000-2005.
// Copyright Alexander Nasonov, 2006-2010.
// Copyright Antony Polukhin, 2011-2014.
//
// 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)
//
// what: lexical_cast custom keyword cast
// who: contributed by Kevlin Henney,
// enhanced with contributions from Terje Slettebo,
// with additional fixes and suggestions from Gennaro Prota,
// Beman Dawes, Dave Abrahams, Daryle Walker, Peter Dimov,
// Alexander Nasonov, Antony Polukhin, Justin Viiret, Michael Hofmann,
// Cheng Yang, Matthew Bradbury, David W. Birdsall, Pavel Korzh and other Boosters
// when: November 2000, March 2003, June 2005, June 2006, March 2011 - 2014
#ifndef BOOST_LEXICAL_CAST_DETAIL_LCAST_UNSIGNED_CONVERTERS_HPP
#define BOOST_LEXICAL_CAST_DETAIL_LCAST_UNSIGNED_CONVERTERS_HPP
#include <boost/config.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
#include <climits>
#include <cstddef>
#include <string>
#include <cstring>
#include <cstdio>
#include <boost/limits.hpp>
#include <boost/mpl/if.hpp>
#include <boost/static_assert.hpp>
#include <boost/detail/workaround.hpp>
#ifndef BOOST_NO_STD_LOCALE
# include <locale>
#else
# ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE
// Getting error at this point means, that your STL library is old/lame/misconfigured.
// If nothing can be done with STL library, define BOOST_LEXICAL_CAST_ASSUME_C_LOCALE,
// but beware: lexical_cast will understand only 'C' locale delimeters and thousands
// separators.
# error "Unable to use <locale> header. Define BOOST_LEXICAL_CAST_ASSUME_C_LOCALE to force "
# error "boost::lexical_cast to use only 'C' locale during conversions."
# endif
#endif
#include <boost/lexical_cast/detail/lcast_char_constants.hpp>
#include <boost/type_traits/make_unsigned.hpp>
#include <boost/type_traits/is_signed.hpp>
#include <boost/noncopyable.hpp>
namespace boost
{
namespace detail // lcast_to_unsigned
{
template<class T>
inline
BOOST_DEDUCED_TYPENAME boost::make_unsigned<T>::type lcast_to_unsigned(const T value) BOOST_NOEXCEPT {
typedef BOOST_DEDUCED_TYPENAME boost::make_unsigned<T>::type result_type;
return value < 0
? static_cast<result_type>(0u - static_cast<result_type>(value))
: static_cast<result_type>(value);
}
}
namespace detail // lcast_put_unsigned
{
template <class Traits, class T, class CharT>
class lcast_put_unsigned: boost::noncopyable {
typedef BOOST_DEDUCED_TYPENAME Traits::int_type int_type;
BOOST_DEDUCED_TYPENAME boost::mpl::if_c<
(sizeof(int_type) > sizeof(T))
, int_type
, T
>::type m_value;
CharT* m_finish;
CharT const m_czero;
int_type const m_zero;
public:
lcast_put_unsigned(const T n_param, CharT* finish) BOOST_NOEXCEPT
: m_value(n_param), m_finish(finish)
, m_czero(lcast_char_constants<CharT>::zero), m_zero(Traits::to_int_type(m_czero))
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT(!std::numeric_limits<T>::is_signed);
#endif
}
CharT* convert() {
#ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE
std::locale loc;
if (loc == std::locale::classic()) {
return main_convert_loop();
}
typedef std::numpunct<CharT> numpunct;
numpunct const& np = BOOST_USE_FACET(numpunct, loc);
std::string const grouping = np.grouping();
std::string::size_type const grouping_size = grouping.size();
if (!grouping_size || grouping[0] <= 0) {
return main_convert_loop();
}
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
// Check that ulimited group is unreachable:
BOOST_STATIC_ASSERT(std::numeric_limits<T>::digits10 < CHAR_MAX);
#endif
CharT const thousands_sep = np.thousands_sep();
std::string::size_type group = 0; // current group number
char last_grp_size = grouping[0];
char left = last_grp_size;
do {
if (left == 0) {
++group;
if (group < grouping_size) {
char const grp_size = grouping[group];
last_grp_size = (grp_size <= 0 ? static_cast<char>(CHAR_MAX) : grp_size);
}
left = last_grp_size;
--m_finish;
Traits::assign(*m_finish, thousands_sep);
}
--left;
} while (main_convert_iteration());
return m_finish;
#else
return main_convert_loop();
#endif
}
private:
inline bool main_convert_iteration() BOOST_NOEXCEPT {
--m_finish;
int_type const digit = static_cast<int_type>(m_value % 10U);
Traits::assign(*m_finish, Traits::to_char_type(m_zero + digit));
m_value /= 10;
return !!m_value; // suppressing warnings
}
inline CharT* main_convert_loop() BOOST_NOEXCEPT {
while (main_convert_iteration());
return m_finish;
}
};
}
namespace detail // lcast_ret_unsigned
{
template <class Traits, class T, class CharT>
class lcast_ret_unsigned: boost::noncopyable {
bool m_multiplier_overflowed;
T m_multiplier;
T& m_value;
const CharT* const m_begin;
const CharT* m_end;
public:
lcast_ret_unsigned(T& value, const CharT* const begin, const CharT* end) BOOST_NOEXCEPT
: m_multiplier_overflowed(false), m_multiplier(1), m_value(value), m_begin(begin), m_end(end)
{
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
BOOST_STATIC_ASSERT(!std::numeric_limits<T>::is_signed);
// GCC when used with flag -std=c++0x may not have std::numeric_limits
// specializations for __int128 and unsigned __int128 types.
// Try compilation with -std=gnu++0x or -std=gnu++11.
//
// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40856
BOOST_STATIC_ASSERT_MSG(std::numeric_limits<T>::is_specialized,
"std::numeric_limits are not specialized for integral type passed to boost::lexical_cast"
);
#endif
}
inline bool convert() {
CharT const czero = lcast_char_constants<CharT>::zero;
--m_end;
m_value = static_cast<T>(0);
if (m_begin > m_end || *m_end < czero || *m_end >= czero + 10)
return false;
m_value = static_cast<T>(*m_end - czero);
--m_end;
#ifdef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE
return main_convert_loop();
#else
std::locale loc;
if (loc == std::locale::classic()) {
return main_convert_loop();
}
typedef std::numpunct<CharT> numpunct;
numpunct const& np = BOOST_USE_FACET(numpunct, loc);
std::string const& grouping = np.grouping();
std::string::size_type const grouping_size = grouping.size();
/* According to Programming languages - C++
* we MUST check for correct grouping
*/
if (!grouping_size || grouping[0] <= 0) {
return main_convert_loop();
}
unsigned char current_grouping = 0;
CharT const thousands_sep = np.thousands_sep();
char remained = static_cast<char>(grouping[current_grouping] - 1);
for (;m_end >= m_begin; --m_end)
{
if (remained) {
if (!main_convert_iteration()) {
return false;
}
--remained;
} else {
if ( !Traits::eq(*m_end, thousands_sep) ) //|| begin == end ) return false;
{
/*
* According to Programming languages - C++
* Digit grouping is checked. That is, the positions of discarded
* separators is examined for consistency with
* use_facet<numpunct<charT> >(loc ).grouping()
*
* BUT what if there is no separators at all and grouping()
* is not empty? Well, we have no extraced separators, so we
* won`t check them for consistency. This will allow us to
* work with "C" locale from other locales
*/
return main_convert_loop();
} else {
if (m_begin == m_end) return false;
if (current_grouping < grouping_size - 1) ++current_grouping;
remained = grouping[current_grouping];
}
}
} /*for*/
return true;
#endif
}
private:
// Iteration that does not care about grouping/separators and assumes that all
// input characters are digits
inline bool main_convert_iteration() BOOST_NOEXCEPT {
CharT const czero = lcast_char_constants<CharT>::zero;
T const maxv = (std::numeric_limits<T>::max)();
m_multiplier_overflowed = m_multiplier_overflowed || (maxv/10 < m_multiplier);
m_multiplier = static_cast<T>(m_multiplier * 10);
T const dig_value = static_cast<T>(*m_end - czero);
T const new_sub_value = static_cast<T>(m_multiplier * dig_value);
// We must correctly handle situations like `000000000000000000000000000001`.
// So we take care of overflow only if `dig_value` is not '0'.
if (*m_end < czero || *m_end >= czero + 10 // checking for correct digit
|| (dig_value && ( // checking for overflow of ...
m_multiplier_overflowed // ... multiplier
|| static_cast<T>(maxv / dig_value) < m_multiplier // ... subvalue
|| static_cast<T>(maxv - new_sub_value) < m_value // ... whole expression
))
) return false;
m_value = static_cast<T>(m_value + new_sub_value);
return true;
}
bool main_convert_loop() BOOST_NOEXCEPT {
for ( ; m_end >= m_begin; --m_end) {
if (!main_convert_iteration()) {
return false;
}
}
return true;
}
};
}
} // namespace boost
#endif // BOOST_LEXICAL_CAST_DETAIL_LCAST_UNSIGNED_CONVERTERS_HPP
@@ -0,0 +1,159 @@
subroutine fil3(x1,n1,c2,n2)
! FIR real-to-complex filter designed using ScopeFIR
!
!-----------------------------------------------
! fsample (Hz) 12000 Input sample rate
! Ntaps 113 Number of filter taps
! fc (Hz) 500 Cutoff frequency
! fstop (Hz) 750 Lower limit of stopband
! Ripple (dB) 0.2 Ripple in passband
! Stop Atten (dB) 50 Stopband attenuation
! fmix (HZ) 1500 Mixing frequency
! fout (Hz) 1500 Output sample rate
! Resulting passband is 1000 - 2000 Hz
! Suggest calling with n1 = 8*n2 + 105, where n2 is the desired number
! of 1500 Hz output samples.
parameter (NTAPS=113)
parameter (NH=NTAPS/2)
parameter (NDOWN=8) !Downsample ratio = 1/8
real x1(n1)
complex z
complex c2(n1/NDOWN)
! Filter coefficients:
complex ca(-NH:NH)
data ca/ &
(-0.001818142144, 0.000000000000), &
(-0.000664066641,-0.000664066640), &
(-0.000000000000,-0.001044063550), &
( 0.000737290018,-0.000737290010), &
( 0.000908957610,-0.000000000000), &
( 0.000444156615, 0.000444156610), &
(-0.000000000000, 0.000202701460), &
( 0.000244876473,-0.000244876470), &
( 0.000978154552, 0.000000000000), &
( 0.001155650277, 0.001155650270), &
( 0.000000000000, 0.002243121590), &
(-0.001927618608, 0.001927618600), &
(-0.003006201675, 0.000000000000), &
(-0.002134087852,-0.002134087850), &
( 0.000000000000,-0.002717699570), &
( 0.001478946738,-0.001478946730), &
( 0.001162489032, 0.000000000000), &
(-0.000005589545,-0.000005589540), &
(-0.000000000000,-0.001321554800), &
( 0.001873767954,-0.001873767950), &
( 0.003843608784,-0.000000000000), &
( 0.003356874940, 0.003356874940), &
(-0.000000000000, 0.005218967040), &
(-0.003640348011, 0.003640348010), &
(-0.004470167307, 0.000000000000), &
(-0.002247131477,-0.002247131470), &
(-0.000000000000,-0.001335998900), &
(-0.000647656208, 0.000647656200), &
(-0.003386100636, 0.000000000000), &
(-0.004114456189,-0.004114456180), &
( 0.000000000000,-0.007939147960), &
( 0.006692816134,-0.006692816130), &
( 0.010145641899, 0.000000000000), &
( 0.006920770724, 0.006920770720), &
( 0.000000000000, 0.008285915750), &
(-0.003992321524, 0.003992321520), &
(-0.001995842303, 0.000000000000), &
( 0.001704388774, 0.001704388770), &
(-0.000000000000, 0.007202515550), &
(-0.008426458377, 0.008426458370), &
(-0.016028350845, 0.000000000000), &
(-0.013430355885,-0.013430355880), &
(-0.000000000000,-0.020297455950), &
( 0.013791263729,-0.013791263720), &
( 0.016298136197,-0.000000000000), &
( 0.007443596155, 0.007443596150), &
(-0.000000000000, 0.002223837360), &
( 0.005924356866,-0.005924356860), &
( 0.020854478160, 0.000000000000), &
( 0.024471928130, 0.024471928130), &
( 0.000000000000, 0.048909701460), &
(-0.044508219241, 0.044508219240), &
(-0.075874892030, 0.000000000000), &
(-0.061450241075,-0.061450241070), &
( 0.000000000000,-0.095332017640), &
( 0.071148679982,-0.071148679980), &
( 0.102420526192, 0.000000000000), &
( 0.071148679982, 0.071148679980), &
( 0.000000000000, 0.095332017640), &
(-0.061450241075, 0.061450241070), &
(-0.075874892030, 0.000000000000), &
(-0.044508219241,-0.044508219240), &
( 0.000000000000,-0.048909701460), &
( 0.024471928130,-0.024471928130), &
( 0.020854478160, 0.000000000000), &
( 0.005924356866, 0.005924356860), &
(-0.000000000000,-0.002223837360), &
( 0.007443596155,-0.007443596150), &
( 0.016298136197,-0.000000000000), &
( 0.013791263729, 0.013791263720), &
(-0.000000000000, 0.020297455950), &
(-0.013430355885, 0.013430355880), &
(-0.016028350845, 0.000000000000), &
(-0.008426458377,-0.008426458370), &
(-0.000000000000,-0.007202515550), &
( 0.001704388774,-0.001704388770), &
(-0.001995842303, 0.000000000000), &
(-0.003992321524,-0.003992321520), &
( 0.000000000000,-0.008285915750), &
( 0.006920770724,-0.006920770720), &
( 0.010145641899, 0.000000000000), &
( 0.006692816134, 0.006692816130), &
( 0.000000000000, 0.007939147960), &
(-0.004114456189, 0.004114456180), &
(-0.003386100636, 0.000000000000), &
(-0.000647656208,-0.000647656200), &
(-0.000000000000, 0.001335998900), &
(-0.002247131477, 0.002247131470), &
(-0.004470167307, 0.000000000000), &
(-0.003640348011,-0.003640348010), &
(-0.000000000000,-0.005218967040), &
( 0.003356874940,-0.003356874940), &
( 0.003843608784,-0.000000000000), &
( 0.001873767954, 0.001873767950), &
(-0.000000000000, 0.001321554800), &
(-0.000005589545, 0.000005589540), &
( 0.001162489032, 0.000000000000), &
( 0.001478946738, 0.001478946730), &
( 0.000000000000, 0.002717699570), &
(-0.002134087852, 0.002134087850), &
(-0.003006201675, 0.000000000000), &
(-0.001927618608,-0.001927618600), &
( 0.000000000000,-0.002243121590), &
( 0.001155650277,-0.001155650270), &
( 0.000978154552, 0.000000000000), &
( 0.000244876473, 0.000244876470), &
(-0.000000000000,-0.000202701460), &
( 0.000444156615,-0.000444156610), &
( 0.000908957610,-0.000000000000), &
( 0.000737290018, 0.000737290010), &
(-0.000000000000, 0.001044063550), &
(-0.000664066641, 0.000664066640), &
(-0.001818142144, 0.000000000000)/
save ca
n2=(n1-NTAPS+NDOWN)/NDOWN
k0=NH-NDOWN+1
! Loop over all output samples
do i=1,n2
z=0.
k=k0 + NDOWN*i
do j=-NH,NH
z=z + x1(j+k)*ca(j)
enddo
c2(i)=z
enddo
return
end subroutine fil3
@@ -0,0 +1,229 @@
// 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 the main "lambda_no_ctps.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
namespace aux {
template<
bool C1 = false, bool C2 = false, bool C3 = false, bool C4 = false
, bool C5 = false
>
struct lambda_or
: true_
{
};
template<>
struct lambda_or< false,false,false,false,false >
: false_
{
};
template< typename Arity > struct lambda_impl
{
template< typename T, typename Tag, typename Protect > struct result_
{
typedef T type;
typedef is_placeholder<T> is_le;
};
};
template<> struct lambda_impl< int_<1> >
{
template< typename F, typename Tag, typename Protect > struct result_
{
typedef lambda< typename F::arg1, Tag, false_ > l1;
typedef typename l1::is_le is_le1;
typedef aux::lambda_or<
BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le1)::value
> is_le;
typedef bind1<
typename F::rebind
, typename l1::type
> bind_;
typedef typename if_<
is_le
, if_< Protect, mpl::protect<bind_>, bind_ >
, identity<F>
>::type type_;
typedef typename type_::type type;
};
};
template<> struct lambda_impl< int_<2> >
{
template< typename F, typename Tag, typename Protect > struct result_
{
typedef lambda< typename F::arg1, Tag, false_ > l1;
typedef lambda< typename F::arg2, Tag, false_ > l2;
typedef typename l1::is_le is_le1;
typedef typename l2::is_le is_le2;
typedef aux::lambda_or<
BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le1)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le2)::value
> is_le;
typedef bind2<
typename F::rebind
, typename l1::type, typename l2::type
> bind_;
typedef typename if_<
is_le
, if_< Protect, mpl::protect<bind_>, bind_ >
, identity<F>
>::type type_;
typedef typename type_::type type;
};
};
template<> struct lambda_impl< int_<3> >
{
template< typename F, typename Tag, typename Protect > struct result_
{
typedef lambda< typename F::arg1, Tag, false_ > l1;
typedef lambda< typename F::arg2, Tag, false_ > l2;
typedef lambda< typename F::arg3, Tag, false_ > l3;
typedef typename l1::is_le is_le1;
typedef typename l2::is_le is_le2;
typedef typename l3::is_le is_le3;
typedef aux::lambda_or<
BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le1)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le2)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le3)::value
> is_le;
typedef bind3<
typename F::rebind
, typename l1::type, typename l2::type, typename l3::type
> bind_;
typedef typename if_<
is_le
, if_< Protect, mpl::protect<bind_>, bind_ >
, identity<F>
>::type type_;
typedef typename type_::type type;
};
};
template<> struct lambda_impl< int_<4> >
{
template< typename F, typename Tag, typename Protect > struct result_
{
typedef lambda< typename F::arg1, Tag, false_ > l1;
typedef lambda< typename F::arg2, Tag, false_ > l2;
typedef lambda< typename F::arg3, Tag, false_ > l3;
typedef lambda< typename F::arg4, Tag, false_ > l4;
typedef typename l1::is_le is_le1;
typedef typename l2::is_le is_le2;
typedef typename l3::is_le is_le3;
typedef typename l4::is_le is_le4;
typedef aux::lambda_or<
BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le1)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le2)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le3)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le4)::value
> is_le;
typedef bind4<
typename F::rebind
, typename l1::type, typename l2::type, typename l3::type
, typename l4::type
> bind_;
typedef typename if_<
is_le
, if_< Protect, mpl::protect<bind_>, bind_ >
, identity<F>
>::type type_;
typedef typename type_::type type;
};
};
template<> struct lambda_impl< int_<5> >
{
template< typename F, typename Tag, typename Protect > struct result_
{
typedef lambda< typename F::arg1, Tag, false_ > l1;
typedef lambda< typename F::arg2, Tag, false_ > l2;
typedef lambda< typename F::arg3, Tag, false_ > l3;
typedef lambda< typename F::arg4, Tag, false_ > l4;
typedef lambda< typename F::arg5, Tag, false_ > l5;
typedef typename l1::is_le is_le1;
typedef typename l2::is_le is_le2;
typedef typename l3::is_le is_le3;
typedef typename l4::is_le is_le4;
typedef typename l5::is_le is_le5;
typedef aux::lambda_or<
BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le1)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le2)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le3)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le4)::value, BOOST_MPL_AUX_MSVC_VALUE_WKND(is_le5)::value
> is_le;
typedef bind5<
typename F::rebind
, typename l1::type, typename l2::type, typename l3::type
, typename l4::type, typename l5::type
> bind_;
typedef typename if_<
is_le
, if_< Protect, mpl::protect<bind_>, bind_ >
, identity<F>
>::type type_;
typedef typename type_::type type;
};
};
} // namespace aux
template<
typename T
, typename Tag
, typename Protect
>
struct lambda
{
/// Metafunction forwarding confuses MSVC 6.x
typedef typename aux::template_arity<T>::type arity_;
typedef typename aux::lambda_impl<arity_>
::template result_< T,Tag,Protect > l_;
typedef typename l_::type type;
typedef typename l_::is_le is_le;
BOOST_MPL_AUX_LAMBDA_SUPPORT(3, lambda, (T, Tag, Protect))
};
BOOST_MPL_AUX_NA_SPEC2(1, 3, lambda)
template<
typename T
>
struct is_lambda_expression
: lambda<T>::is_le
{
};
}}
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,112 @@
subroutine zplt(z,iplt,sync,dtx,nfreq,flip,sync2,nplot,emedelay,dttol, &
nfqso,ntol)
real z(458,65)
real zz(458,65)
integer ij(2)
character*4 lab
call pctile(z,458*65,84,rms)
fac=0.05/rms
z=fac*z
dtq=0.114286
df=11025.0/(2.0*2520.0)
ia=nint((nfqso-ntol)/df) - 273
if(ia.lt.1) ia=1
ib=nint((nfqso+ntol)/df) - 273
if(ib.gt.458) ib=458
ja=(emedelay+0.8-dttol)/dtq
if(ja.lt.1) ja=1
jb=(emedelay+0.8+dttol)/dtq
if(jb.gt.65) jb=65
zz=0.
zz(ia:ib,ja:jb)=z(ia:ib,ja:jb)
zmin=minval(zz)
zmax=maxval(zz)
flip=1.0
if(abs(zmin).gt.abs(zmax)) flip=-1.0
ij=maxloc(zz)
if(flip.lt.0.0) ij=minloc(zz)
i0=ij(1)
j0=ij(2)
nfreq=nint((i0+273)*df)
dtx=j0*dtq-0.8
! write(69,3101) ia,ib,ja,jb,ij,dtx,nfreq
!3101 format(6i5,f8.2,i6)
ia=max(1,i0-72)
ib=min(458,i0+72)
sync=16.33*flip*(z(i0,j0) - 0.5*(z(ia,j0)+z(ib,j0)))
sync2=20.0*flip*z(i0,j0)
if(nplot.eq.0) go to 900
zmax=max(abs(zmin),abs(zmax),1.0)
zmin=-zmax
do j=1,65
write(61,1100) j*dtq-0.8,z(i0,j)
1100 format(2f10.3)
enddo
do i=1,458
write(62,1100) (i+273)*df,flip*z(i,j0)
enddo
xx=1.5
yy=7.5 - 3.0*iplt
width=6.0
height=2.0
IP=458
JP=65
imax=IP
jmax=JP
if(iplt.eq.0) then
call imopen("testjt4.ps")
call imfont("Helvetica",16)
call impalette("BlueRed.pal")
endif
call imr4mat_color(z,IP,JP,imax,jmax,zmin,zmax,xx,yy, &
width,height,1)
call imstring("Frequency (Hz)",xx+0.5*width,yy-0.5,2,0)
dy=0.1
do i=1,9
x=xx + 0.1*i*width
call imyline(x,yy,dy)
call imyline(x,yy+height,-dy)
enddo
do i=1,6
nf=(i-1)*200 + 600
write(lab,1020) nf
1020 format(i4)
x=xx + (i-1)*0.2*width
call imstring(lab,x,yy-0.25,2,0)
enddo
dx=0.1
do i=0,6
y=yy + height*(0.8+i)/(65.0*0.114286)
call imxline(xx,y,dx)
call imxline(xx+width,y,-dx)
enddo
do i=0,6,2
y=yy + height*(0.8+i)/(65.0*0.114286)
write(lab,1020) i
call imstring(lab(4:4),xx-0.15,y-0.08,2,0)
enddo
y=yy + height*(3.8)/(65.0*0.114286)
call imstring("DT", xx-0.5,y ,2,0)
call imstring("(s)",xx-0.5,y-0.25,2,0)
if(iplt.eq.2) call imclose
900 return
end subroutine zplt
@@ -0,0 +1,350 @@
// Copyright Thijs van den Berg, 2008.
// Copyright John Maddock 2008.
// Copyright Paul A. Bristow 2008, 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)
// This module implements the Laplace distribution.
// Weisstein, Eric W. "Laplace Distribution." From MathWorld--A Wolfram Web Resource.
// http://mathworld.wolfram.com/LaplaceDistribution.html
// http://en.wikipedia.org/wiki/Laplace_distribution
//
// Abramowitz and Stegun 1972, p 930
// http://www.math.sfu.ca/~cbm/aands/page_930.htm
#ifndef BOOST_STATS_LAPLACE_HPP
#define BOOST_STATS_LAPLACE_HPP
#include <boost/math/distributions/detail/common_error_handling.hpp>
#include <boost/math/distributions/complement.hpp>
#include <boost/math/constants/constants.hpp>
#include <limits>
namespace boost{ namespace math{
#ifdef BOOST_MSVC
# pragma warning(push)
# pragma warning(disable:4127) // conditional expression is constant
#endif
template <class RealType = double, class Policy = policies::policy<> >
class laplace_distribution
{
public:
// ----------------------------------
// public Types
// ----------------------------------
typedef RealType value_type;
typedef Policy policy_type;
// ----------------------------------
// Constructor(s)
// ----------------------------------
laplace_distribution(RealType l_location = 0, RealType l_scale = 1)
: m_location(l_location), m_scale(l_scale)
{
RealType result;
check_parameters("boost::math::laplace_distribution<%1%>::laplace_distribution()", &result);
}
// ----------------------------------
// Public functions
// ----------------------------------
RealType location() const
{
return m_location;
}
RealType scale() const
{
return m_scale;
}
bool check_parameters(const char* function, RealType* result) const
{
if(false == detail::check_scale(function, m_scale, result, Policy())) return false;
if(false == detail::check_location(function, m_location, result, Policy())) return false;
return true;
}
private:
RealType m_location;
RealType m_scale;
}; // class laplace_distribution
//
// Convenient type synonym for double.
typedef laplace_distribution<double> laplace;
//
// Non-member functions.
template <class RealType, class Policy>
inline const std::pair<RealType, RealType> range(const laplace_distribution<RealType, Policy>&)
{
if (std::numeric_limits<RealType>::has_infinity)
{ // Can use infinity.
return std::pair<RealType, RealType>(-std::numeric_limits<RealType>::infinity(), std::numeric_limits<RealType>::infinity()); // - to + infinity.
}
else
{ // Can only use max_value.
using boost::math::tools::max_value;
return std::pair<RealType, RealType>(-max_value<RealType>(), max_value<RealType>()); // - to + max value.
}
}
template <class RealType, class Policy>
inline const std::pair<RealType, RealType> support(const laplace_distribution<RealType, Policy>&)
{
if (std::numeric_limits<RealType>::has_infinity)
{ // Can Use infinity.
return std::pair<RealType, RealType>(-std::numeric_limits<RealType>::infinity(), std::numeric_limits<RealType>::infinity()); // - to + infinity.
}
else
{ // Can only use max_value.
using boost::math::tools::max_value;
return std::pair<RealType, RealType>(-max_value<RealType>(), max_value<RealType>()); // - to + max value.
}
}
template <class RealType, class Policy>
inline RealType pdf(const laplace_distribution<RealType, Policy>& dist, const RealType& x)
{
BOOST_MATH_STD_USING // for ADL of std functions
// Checking function argument
RealType result = 0;
const char* function = "boost::math::pdf(const laplace_distribution<%1%>&, %1%))";
// Check scale and location.
if (false == dist.check_parameters(function, &result)) return result;
// Special pdf values.
if((boost::math::isinf)(x))
{
return 0; // pdf + and - infinity is zero.
}
if (false == detail::check_x(function, x, &result, Policy())) return result;
// General case
RealType scale( dist.scale() );
RealType location( dist.location() );
RealType exponent = x - location;
if (exponent>0) exponent = -exponent;
exponent /= scale;
result = exp(exponent);
result /= 2 * scale;
return result;
} // pdf
template <class RealType, class Policy>
inline RealType cdf(const laplace_distribution<RealType, Policy>& dist, const RealType& x)
{
BOOST_MATH_STD_USING // For ADL of std functions.
RealType result = 0;
// Checking function argument.
const char* function = "boost::math::cdf(const laplace_distribution<%1%>&, %1%)";
// Check scale and location.
if (false == dist.check_parameters(function, &result)) return result;
// Special cdf values:
if((boost::math::isinf)(x))
{
if(x < 0) return 0; // -infinity.
return 1; // + infinity.
}
if (false == detail::check_x(function, x, &result, Policy())) return result;
// General cdf values
RealType scale( dist.scale() );
RealType location( dist.location() );
if (x < location)
{
result = exp( (x-location)/scale )/2;
}
else
{
result = 1 - exp( (location-x)/scale )/2;
}
return result;
} // cdf
template <class RealType, class Policy>
inline RealType quantile(const laplace_distribution<RealType, Policy>& dist, const RealType& p)
{
BOOST_MATH_STD_USING // for ADL of std functions.
// Checking function argument
RealType result = 0;
const char* function = "boost::math::quantile(const laplace_distribution<%1%>&, %1%)";
if (false == dist.check_parameters(function, &result)) return result;
if(false == detail::check_probability(function, p, &result, Policy())) return result;
// Extreme values of p:
if(p == 0)
{
result = policies::raise_overflow_error<RealType>(function,
"probability parameter is 0, but must be > 0!", Policy());
return -result; // -std::numeric_limits<RealType>::infinity();
}
if(p == 1)
{
result = policies::raise_overflow_error<RealType>(function,
"probability parameter is 1, but must be < 1!", Policy());
return result; // std::numeric_limits<RealType>::infinity();
}
// Calculate Quantile
RealType scale( dist.scale() );
RealType location( dist.location() );
if (p - 0.5 < 0.0)
result = location + scale*log( static_cast<RealType>(p*2) );
else
result = location - scale*log( static_cast<RealType>(-p*2 + 2) );
return result;
} // quantile
template <class RealType, class Policy>
inline RealType cdf(const complemented2_type<laplace_distribution<RealType, Policy>, RealType>& c)
{
// Calculate complement of cdf.
BOOST_MATH_STD_USING // for ADL of std functions
RealType scale = c.dist.scale();
RealType location = c.dist.location();
RealType x = c.param;
RealType result = 0;
// Checking function argument.
const char* function = "boost::math::cdf(const complemented2_type<laplace_distribution<%1%>, %1%>&)";
// Check scale and location.
//if(false == detail::check_scale(function, scale, result, Policy())) return false;
//if(false == detail::check_location(function, location, result, Policy())) return false;
if (false == c.dist.check_parameters(function, &result)) return result;
// Special cdf values.
if((boost::math::isinf)(x))
{
if(x < 0) return 1; // cdf complement -infinity is unity.
return 0; // cdf complement +infinity is zero.
}
if(false == detail::check_x(function, x, &result, Policy()))return result;
// Cdf interval value.
if (-x < -location)
{
result = exp( (-x+location)/scale )/2;
}
else
{
result = 1 - exp( (-location+x)/scale )/2;
}
return result;
} // cdf complement
template <class RealType, class Policy>
inline RealType quantile(const complemented2_type<laplace_distribution<RealType, Policy>, RealType>& c)
{
BOOST_MATH_STD_USING // for ADL of std functions.
// Calculate quantile.
RealType scale = c.dist.scale();
RealType location = c.dist.location();
RealType q = c.param;
RealType result = 0;
// Checking function argument.
const char* function = "quantile(const complemented2_type<laplace_distribution<%1%>, %1%>&)";
if (false == c.dist.check_parameters(function, &result)) return result;
// Extreme values.
if(q == 0)
{
return std::numeric_limits<RealType>::infinity();
}
if(q == 1)
{
return -std::numeric_limits<RealType>::infinity();
}
if(false == detail::check_probability(function, q, &result, Policy())) return result;
if (0.5 - q < 0.0)
result = location + scale*log( static_cast<RealType>(-q*2 + 2) );
else
result = location - scale*log( static_cast<RealType>(q*2) );
return result;
} // quantile
template <class RealType, class Policy>
inline RealType mean(const laplace_distribution<RealType, Policy>& dist)
{
return dist.location();
}
template <class RealType, class Policy>
inline RealType standard_deviation(const laplace_distribution<RealType, Policy>& dist)
{
return constants::root_two<RealType>() * dist.scale();
}
template <class RealType, class Policy>
inline RealType mode(const laplace_distribution<RealType, Policy>& dist)
{
return dist.location();
}
template <class RealType, class Policy>
inline RealType median(const laplace_distribution<RealType, Policy>& dist)
{
return dist.location();
}
template <class RealType, class Policy>
inline RealType skewness(const laplace_distribution<RealType, Policy>& /*dist*/)
{
return 0;
}
template <class RealType, class Policy>
inline RealType kurtosis(const laplace_distribution<RealType, Policy>& /*dist*/)
{
return 6;
}
template <class RealType, class Policy>
inline RealType kurtosis_excess(const laplace_distribution<RealType, Policy>& /*dist*/)
{
return 3;
}
#ifdef BOOST_MSVC
# pragma warning(pop)
#endif
} // namespace math
} // namespace boost
// This include must be at the end, *after* the accessors
// for this distribution have been defined, in order to
// keep compilers that support two-phase lookup happy.
#include <boost/math/distributions/detail/derived_accessors.hpp>
#endif // BOOST_STATS_LAPLACE_HPP
@@ -0,0 +1,44 @@
/* Copyright 2003-2013 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* See http://www.boost.org/libs/multi_index for library home page.
*/
#ifndef BOOST_MULTI_INDEX_DETAIL_ADL_SWAP_HPP
#define BOOST_MULTI_INDEX_DETAIL_ADL_SWAP_HPP
#if defined(_MSC_VER)
#pragma once
#endif
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
#include <algorithm>
namespace boost{
namespace multi_index{
namespace detail{
template<typename T>
void adl_swap(T& x,T& y)
{
#if !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL)
using std::swap;
swap(x,y);
#else
std::swap(x,y);
#endif
}
} /* namespace multi_index::detail */
} /* namespace multi_index */
} /* namespace boost */
#endif
@@ -0,0 +1,702 @@
/*=============================================================================
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)
==============================================================================*/
template <typename Dummy>
struct function_ptr_impl<2, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1>
RT operator()(A0 & a0 , A1 & a1) const
{
return fp(a0 , a1);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<3, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2) const
{
return fp(a0 , a1 , a2);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<4, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3) const
{
return fp(a0 , a1 , a2 , a3);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<5, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4) const
{
return fp(a0 , a1 , a2 , a3 , a4);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<6, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<7, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<8, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<9, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<10, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<11, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<12, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10 , A11 & a11) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<13, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10 , A11 & a11 , A12 & a12) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<14, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10 , A11 & a11 , A12 & a12 , A13 & a13) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<15, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10 , A11 & a11 , A12 & a12 , A13 & a13 , A14 & a14) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<16, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10 , A11 & a11 , A12 & a12 , A13 & a13 , A14 & a14 , A15 & a15) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<17, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10 , A11 & a11 , A12 & a12 , A13 & a13 , A14 & a14 , A15 & a15 , A16 & a16) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<18, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10 , A11 & a11 , A12 & a12 , A13 & a13 , A14 & a14 , A15 & a15 , A16 & a16 , A17 & a17) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<19, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10 , A11 & a11 , A12 & a12 , A13 & a13 , A14 & a14 , A15 & a15 , A16 & a16 , A17 & a17 , A18 & a18) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<20, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10 , A11 & a11 , A12 & a12 , A13 & a13 , A14 & a14 , A15 & a15 , A16 & a16 , A17 & a17 , A18 & a18 , A19 & a19) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<21, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10 , A11 & a11 , A12 & a12 , A13 & a13 , A14 & a14 , A15 & a15 , A16 & a16 , A17 & a17 , A18 & a18 , A19 & a19 , A20 & a20) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<22, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10 , A11 & a11 , A12 & a12 , A13 & a13 , A14 & a14 , A15 & a15 , A16 & a16 , A17 & a17 , A18 & a18 , A19 & a19 , A20 & a20 , A21 & a21) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<23, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10 , A11 & a11 , A12 & a12 , A13 & a13 , A14 & a14 , A15 & a15 , A16 & a16 , A17 & a17 , A18 & a18 , A19 & a19 , A20 & a20 , A21 & a21 , A22 & a22) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<24, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10 , A11 & a11 , A12 & a12 , A13 & a13 , A14 & a14 , A15 & a15 , A16 & a16 , A17 & a17 , A18 & a18 , A19 & a19 , A20 & a20 , A21 & a21 , A22 & a22 , A23 & a23) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<25, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10 , A11 & a11 , A12 & a12 , A13 & a13 , A14 & a14 , A15 & a15 , A16 & a16 , A17 & a17 , A18 & a18 , A19 & a19 , A20 & a20 , A21 & a21 , A22 & a22 , A23 & a23 , A24 & a24) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<26, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10 , A11 & a11 , A12 & a12 , A13 & a13 , A14 & a14 , A15 & a15 , A16 & a16 , A17 & a17 , A18 & a18 , A19 & a19 , A20 & a20 , A21 & a21 , A22 & a22 , A23 & a23 , A24 & a24 , A25 & a25) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<27, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10 , A11 & a11 , A12 & a12 , A13 & a13 , A14 & a14 , A15 & a15 , A16 & a16 , A17 & a17 , A18 & a18 , A19 & a19 , A20 & a20 , A21 & a21 , A22 & a22 , A23 & a23 , A24 & a24 , A25 & a25 , A26 & a26) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<28, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26 , typename A27>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10 , A11 & a11 , A12 & a12 , A13 & a13 , A14 & a14 , A15 & a15 , A16 & a16 , A17 & a17 , A18 & a18 , A19 & a19 , A20 & a20 , A21 & a21 , A22 & a22 , A23 & a23 , A24 & a24 , A25 & a25 , A26 & a26 , A27 & a27) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26 , a27);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<29, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26 , typename A27 , typename A28>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10 , A11 & a11 , A12 & a12 , A13 & a13 , A14 & a14 , A15 & a15 , A16 & a16 , A17 & a17 , A18 & a18 , A19 & a19 , A20 & a20 , A21 & a21 , A22 & a22 , A23 & a23 , A24 & a24 , A25 & a25 , A26 & a26 , A27 & a27 , A28 & a28) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26 , a27 , a28);
}
FP fp;
};
};
template <typename Dummy>
struct function_ptr_impl<30, Dummy>
{
template <typename RT, typename FP>
struct impl
{
typedef RT result_type;
impl(FP fp_)
: fp(fp_) {}
template <typename A0 , typename A1 , typename A2 , typename A3 , typename A4 , typename A5 , typename A6 , typename A7 , typename A8 , typename A9 , typename A10 , typename A11 , typename A12 , typename A13 , typename A14 , typename A15 , typename A16 , typename A17 , typename A18 , typename A19 , typename A20 , typename A21 , typename A22 , typename A23 , typename A24 , typename A25 , typename A26 , typename A27 , typename A28 , typename A29>
RT operator()(A0 & a0 , A1 & a1 , A2 & a2 , A3 & a3 , A4 & a4 , A5 & a5 , A6 & a6 , A7 & a7 , A8 & a8 , A9 & a9 , A10 & a10 , A11 & a11 , A12 & a12 , A13 & a13 , A14 & a14 , A15 & a15 , A16 & a16 , A17 & a17 , A18 & a18 , A19 & a19 , A20 & a20 , A21 & a21 , A22 & a22 , A23 & a23 , A24 & a24 , A25 & a25 , A26 & a26 , A27 & a27 , A28 & a28 , A29 & a29) const
{
return fp(a0 , a1 , a2 , a3 , a4 , a5 , a6 , a7 , a8 , a9 , a10 , a11 , a12 , a13 , a14 , a15 , a16 , a17 , a18 , a19 , a20 , a21 , a22 , a23 , a24 , a25 , a26 , a27 , a28 , a29);
}
FP fp;
};
};
@@ -0,0 +1,323 @@
// 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 the main "list.hpp" header
// -- DO NOT modify by hand!
namespace boost { namespace mpl {
template<
typename T0 = na, typename T1 = na, typename T2 = na, typename T3 = na
, typename T4 = na, typename T5 = na, typename T6 = na, typename T7 = na
, typename T8 = na, typename T9 = na, typename T10 = na, typename T11 = na
, typename T12 = na, typename T13 = na, typename T14 = na
, typename T15 = na, typename T16 = na, typename T17 = na
, typename T18 = na, typename T19 = na
>
struct list;
template<
>
struct list<
na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: list0< >
{
typedef list0< >::type type;
};
template<
typename T0
>
struct list<
T0, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: list1<T0>
{
typedef typename list1<T0>::type type;
};
template<
typename T0, typename T1
>
struct list<
T0, T1, na, na, na, na, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: list2< T0,T1 >
{
typedef typename list2< T0,T1 >::type type;
};
template<
typename T0, typename T1, typename T2
>
struct list<
T0, T1, T2, na, na, na, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: list3< T0,T1,T2 >
{
typedef typename list3< T0,T1,T2 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3
>
struct list<
T0, T1, T2, T3, na, na, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: list4< T0,T1,T2,T3 >
{
typedef typename list4< T0,T1,T2,T3 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
>
struct list<
T0, T1, T2, T3, T4, na, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: list5< T0,T1,T2,T3,T4 >
{
typedef typename list5< T0,T1,T2,T3,T4 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5
>
struct list<
T0, T1, T2, T3, T4, T5, na, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: list6< T0,T1,T2,T3,T4,T5 >
{
typedef typename list6< T0,T1,T2,T3,T4,T5 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6
>
struct list<
T0, T1, T2, T3, T4, T5, T6, na, na, na, na, na, na, na, na, na, na
, na, na, na
>
: list7< T0,T1,T2,T3,T4,T5,T6 >
{
typedef typename list7< T0,T1,T2,T3,T4,T5,T6 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7
>
struct list<
T0, T1, T2, T3, T4, T5, T6, T7, na, na, na, na, na, na, na, na, na
, na, na, na
>
: list8< T0,T1,T2,T3,T4,T5,T6,T7 >
{
typedef typename list8< T0,T1,T2,T3,T4,T5,T6,T7 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8
>
struct list<
T0, T1, T2, T3, T4, T5, T6, T7, T8, na, na, na, na, na, na, na, na
, na, na, na
>
: list9< T0,T1,T2,T3,T4,T5,T6,T7,T8 >
{
typedef typename list9< T0,T1,T2,T3,T4,T5,T6,T7,T8 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
>
struct list<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, na, na, na, na, na, na, na
, na, na, na
>
: list10< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 >
{
typedef typename list10< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10
>
struct list<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, na, na, na, na, na, na
, na, na, na
>
: list11< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10 >
{
typedef typename list11< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11
>
struct list<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, na, na, na, na
, na, na, na, na
>
: list12< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11 >
{
typedef typename list12< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12
>
struct list<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, na, na, na
, na, na, na, na
>
: list13< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12 >
{
typedef typename list13< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13
>
struct list<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, na, na
, na, na, na, na
>
: list14< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13 >
{
typedef typename list14< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
>
struct list<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, na
, na, na, na, na
>
: list15<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
>
{
typedef typename list15< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15
>
struct list<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, na, na, na, na
>
: list16<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15
>
{
typedef typename list16< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16
>
struct list<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16, na, na, na
>
: list17<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16
>
{
typedef typename list17< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17
>
struct list<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16, T17, na, na
>
: list18<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16, T17
>
{
typedef typename list18< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17 >::type type;
};
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18
>
struct list<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16, T17, T18, na
>
: list19<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16, T17, T18
>
{
typedef typename list19< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18 >::type type;
};
/// primary template (not a specialization!)
template<
typename T0, typename T1, typename T2, typename T3, typename T4
, typename T5, typename T6, typename T7, typename T8, typename T9
, typename T10, typename T11, typename T12, typename T13, typename T14
, typename T15, typename T16, typename T17, typename T18, typename T19
>
struct list
: list20<
T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14
, T15, T16, T17, T18, T19
>
{
typedef typename list20< T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19 >::type type;
};
}}
@@ -0,0 +1,84 @@
/*
[auto_generated]
boost/numeric/odeint/stepper/detail/rotating_buffer.hpp
[begin_description]
Implemetation of a rotating (cyclic) buffer for use in the Adam Bashforth stepper
[end_description]
Copyright 2011 Karsten Ahnert
Copyright 2011 Mario Mulansky
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or
copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ROTATING_BUFFER_HPP_INCLUDED
#define BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ROTATING_BUFFER_HPP_INCLUDED
#include <boost/array.hpp>
namespace boost {
namespace numeric {
namespace odeint {
namespace detail {
template< class T , size_t N >
class rotating_buffer
{
public:
typedef T value_type;
const static size_t dim = N;
rotating_buffer( void ) : m_first( 0 )
{ }
size_t size( void ) const
{
return dim;
}
value_type& operator[]( size_t i )
{
return m_data[ get_index( i ) ];
}
const value_type& operator[]( size_t i ) const
{
return m_data[ get_index( i ) ];
}
void rotate( void )
{
if( m_first == 0 )
m_first = dim-1;
else
--m_first;
}
protected:
value_type m_data[N];
private:
size_t get_index( size_t i ) const
{
return ( ( i + m_first ) % dim );
}
size_t m_first;
};
} // detail
} // odeint
} // numeric
} // boost
#endif // BOOST_NUMERIC_ODEINT_STEPPER_DETAIL_ROTATING_BUFFER_HPP_INCLUDED
@@ -0,0 +1,28 @@
// (C) Copyright John Maddock 2005.
// 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)
//
// The aim of this header is just to include <memory> but to do
// so in a way that does not result in recursive inclusion of
// the Boost TR1 components if boost/tr1/tr1/memory is in the
// include search path. We have to do this to avoid circular
// dependencies:
//
#ifndef BOOST_CONFIG_MEMORY
# define BOOST_CONFIG_MEMORY
# ifndef BOOST_TR1_NO_RECURSION
# define BOOST_TR1_NO_RECURSION
# define BOOST_CONFIG_NO_MEMORY_RECURSION
# endif
# include <memory>
# ifdef BOOST_CONFIG_NO_MEMORY_RECURSION
# undef BOOST_TR1_NO_RECURSION
# undef BOOST_CONFIG_NO_MEMORY_RECURSION
# endif
#endif
@@ -0,0 +1,314 @@
// (C) Copyright John Maddock 2001.
// (C) Copyright Jens Maurer 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org for most recent version.
// config for libstdc++ v3
// not much to go in here:
#define BOOST_GNU_STDLIB 1
#ifdef __GLIBCXX__
#define BOOST_STDLIB "GNU libstdc++ version " BOOST_STRINGIZE(__GLIBCXX__)
#else
#define BOOST_STDLIB "GNU libstdc++ version " BOOST_STRINGIZE(__GLIBCPP__)
#endif
#if !defined(_GLIBCPP_USE_WCHAR_T) && !defined(_GLIBCXX_USE_WCHAR_T)
# define BOOST_NO_CWCHAR
# define BOOST_NO_CWCTYPE
# define BOOST_NO_STD_WSTRING
# define BOOST_NO_STD_WSTREAMBUF
#endif
#if defined(__osf__) && !defined(_REENTRANT) \
&& ( defined(_GLIBCXX_HAVE_GTHR_DEFAULT) || defined(_GLIBCPP_HAVE_GTHR_DEFAULT) )
// GCC 3 on Tru64 forces the definition of _REENTRANT when any std lib header
// file is included, therefore for consistency we define it here as well.
# define _REENTRANT
#endif
#ifdef __GLIBCXX__ // gcc 3.4 and greater:
# if defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \
|| defined(_GLIBCXX__PTHREADS) \
|| defined(_GLIBCXX_HAS_GTHREADS) \
|| defined(_WIN32) \
|| defined(_AIX) \
|| defined(__HAIKU__)
//
// If the std lib has thread support turned on, then turn it on in Boost
// as well. We do this because some gcc-3.4 std lib headers define _REENTANT
// while others do not...
//
# define BOOST_HAS_THREADS
# else
# define BOOST_DISABLE_THREADS
# endif
#elif defined(__GLIBCPP__) \
&& !defined(_GLIBCPP_HAVE_GTHR_DEFAULT) \
&& !defined(_GLIBCPP__PTHREADS)
// disable thread support if the std lib was built single threaded:
# define BOOST_DISABLE_THREADS
#endif
#if (defined(linux) || defined(__linux) || defined(__linux__)) && defined(__arm__) && defined(_GLIBCPP_HAVE_GTHR_DEFAULT)
// linux on arm apparently doesn't define _REENTRANT
// so just turn on threading support whenever the std lib is thread safe:
# define BOOST_HAS_THREADS
#endif
#if !defined(_GLIBCPP_USE_LONG_LONG) \
&& !defined(_GLIBCXX_USE_LONG_LONG)\
&& defined(BOOST_HAS_LONG_LONG)
// May have been set by compiler/*.hpp, but "long long" without library
// support is useless.
# undef BOOST_HAS_LONG_LONG
#endif
// Apple doesn't seem to reliably defined a *unix* macro
#if !defined(CYGWIN) && ( defined(__unix__) \
|| defined(__unix) \
|| defined(unix) \
|| defined(__APPLE__) \
|| defined(__APPLE) \
|| defined(APPLE))
# include <unistd.h>
#endif
#if defined(__GLIBCXX__) || (defined(__GLIBCPP__) && __GLIBCPP__>=20020514) // GCC >= 3.1.0
# define BOOST_STD_EXTENSION_NAMESPACE __gnu_cxx
# define BOOST_HAS_SLIST
# define BOOST_HAS_HASH
# define BOOST_SLIST_HEADER <ext/slist>
# if !defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3)
# define BOOST_HASH_SET_HEADER <ext/hash_set>
# define BOOST_HASH_MAP_HEADER <ext/hash_map>
# else
# define BOOST_HASH_SET_HEADER <backward/hash_set>
# define BOOST_HASH_MAP_HEADER <backward/hash_map>
# endif
#endif
//
// Decide whether we have C++11 support turned on:
//
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103)
# define BOOST_LIBSTDCXX11
#endif
//
// Decide which version of libstdc++ we have, normally
// stdlibc++ C++0x support is detected via __GNUC__, __GNUC_MINOR__, and possibly
// __GNUC_PATCHLEVEL__ at the suggestion of Jonathan Wakely, one of the stdlibc++
// developers. He also commented:
//
// "I'm not sure how useful __GLIBCXX__ is for your purposes, for instance in
// GCC 4.2.4 it is set to 20080519 but in GCC 4.3.0 it is set to 20080305.
// Although 4.3.0 was released earlier than 4.2.4, it has better C++0x support
// than any release in the 4.2 series."
//
// Another resource for understanding stdlibc++ features is:
// http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#manual.intro.status.standard.200x
//
// However, using the GCC version number fails when the compiler is clang since this
// only ever claims to emulate GCC-4.2, see https://svn.boost.org/trac/boost/ticket/7473
// for a long discussion on this issue. What we can do though is use clang's __has_include
// to detect the presence of a C++11 header that was introduced with a specific GCC release.
// We still have to be careful though as many such headers were buggy and/or incomplete when
// first introduced, so we only check for headers that were fully featured from day 1, and then
// use that to infer the underlying GCC version:
//
#ifdef __clang__
#if __has_include(<experimental/memory_resource>)
# define BOOST_LIBSTDCXX_VERSION 60100
#elif __has_include(<experimental/any>)
# define BOOST_LIBSTDCXX_VERSION 50100
#elif __has_include(<shared_mutex>)
# define BOOST_LIBSTDCXX_VERSION 40900
#elif __has_include(<ext/cmath>)
# define BOOST_LIBSTDCXX_VERSION 40800
#elif __has_include(<scoped_allocator>)
# define BOOST_LIBSTDCXX_VERSION 40700
#elif __has_include(<typeindex>)
# define BOOST_LIBSTDCXX_VERSION 40600
#elif __has_include(<future>)
# define BOOST_LIBSTDCXX_VERSION 40500
#elif __has_include(<ratio>)
# define BOOST_LIBSTDCXX_VERSION 40400
#elif __has_include(<array>)
# define BOOST_LIBSTDCXX_VERSION 40300
#endif
//
// GCC 4.8 and 9 add working versions of <atomic> and <regex> respectively.
// However, we have no test for these as the headers were present but broken
// in early GCC versions.
//
#endif
#if defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130) && (__cplusplus >= 201103L)
//
// Oracle Solaris compiler uses it's own verison of libstdc++ but doesn't
// set __GNUC__
//
#if __SUNPRO_CC >= 0x5140
#define BOOST_LIBSTDCXX_VERSION 50100
#else
#define BOOST_LIBSTDCXX_VERSION 40800
#endif
#endif
#if !defined(BOOST_LIBSTDCXX_VERSION)
# define BOOST_LIBSTDCXX_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif
// std::auto_ptr isn't provided with _GLIBCXX_DEPRECATED=0 (GCC 4.5 and earlier)
// or _GLIBCXX_USE_DEPRECATED=0 (GCC 4.6 and later).
#if defined(BOOST_LIBSTDCXX11)
# if BOOST_LIBSTDCXX_VERSION < 40600
# if !_GLIBCXX_DEPRECATED
# define BOOST_NO_AUTO_PTR
# endif
# elif !_GLIBCXX_USE_DEPRECATED
# define BOOST_NO_AUTO_PTR
# endif
#endif
// C++0x headers in GCC 4.3.0 and later
//
#if (BOOST_LIBSTDCXX_VERSION < 40300) || !defined(BOOST_LIBSTDCXX11)
# define BOOST_NO_CXX11_HDR_ARRAY
# define BOOST_NO_CXX11_HDR_TUPLE
# define BOOST_NO_CXX11_HDR_UNORDERED_MAP
# define BOOST_NO_CXX11_HDR_UNORDERED_SET
# define BOOST_NO_CXX11_HDR_FUNCTIONAL
#endif
// C++0x headers in GCC 4.4.0 and later
//
#if (BOOST_LIBSTDCXX_VERSION < 40400) || !defined(BOOST_LIBSTDCXX11)
# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
# define BOOST_NO_CXX11_HDR_FORWARD_LIST
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
# define BOOST_NO_CXX11_HDR_MUTEX
# define BOOST_NO_CXX11_HDR_RATIO
# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR
# define BOOST_NO_CXX11_SMART_PTR
#else
# define BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG
# define BOOST_HAS_TR1_COMPLEX_OVERLOADS
#endif
// C++0x features in GCC 4.5.0 and later
//
#if (BOOST_LIBSTDCXX_VERSION < 40500) || !defined(BOOST_LIBSTDCXX11)
# define BOOST_NO_CXX11_NUMERIC_LIMITS
# define BOOST_NO_CXX11_HDR_FUTURE
# define BOOST_NO_CXX11_HDR_RANDOM
#endif
// C++0x features in GCC 4.6.0 and later
//
#if (BOOST_LIBSTDCXX_VERSION < 40600) || !defined(BOOST_LIBSTDCXX11)
# define BOOST_NO_CXX11_HDR_TYPEINDEX
# define BOOST_NO_CXX11_ADDRESSOF
#endif
// C++0x features in GCC 4.7.0 and later
//
#if (BOOST_LIBSTDCXX_VERSION < 40700) || !defined(BOOST_LIBSTDCXX11)
// Note that although <chrono> existed prior to 4.7, "steady_clock" is spelled "monotonic_clock"
// so 4.7.0 is the first truely conforming one.
# define BOOST_NO_CXX11_HDR_CHRONO
# define BOOST_NO_CXX11_ALLOCATOR
#endif
// C++0x features in GCC 4.8.0 and later
//
#if (BOOST_LIBSTDCXX_VERSION < 40800) || !defined(BOOST_LIBSTDCXX11)
// Note that although <atomic> existed prior to gcc 4.8 it was largely unimplemented for many types:
# define BOOST_NO_CXX11_HDR_ATOMIC
# define BOOST_NO_CXX11_HDR_THREAD
#endif
// C++0x features in GCC 4.9.0 and later
//
#if (BOOST_LIBSTDCXX_VERSION < 40900) || !defined(BOOST_LIBSTDCXX11)
// Although <regex> is present and compilable against, the actual implementation is not functional
// even for the simplest patterns such as "\d" or "[0-9]". This is the case at least in gcc up to 4.8, inclusively.
# define BOOST_NO_CXX11_HDR_REGEX
#endif
#if (BOOST_LIBSTDCXX_VERSION < 40900) || (__cplusplus <= 201103)
# define BOOST_NO_CXX14_STD_EXCHANGE
#endif
#if defined(__clang_major__) && ((__clang_major__ < 3) || ((__clang_major__ == 3) && (__clang_minor__ < 7)))
// As of clang-3.6, libstdc++ header <atomic> throws up errors with clang:
# define BOOST_NO_CXX11_HDR_ATOMIC
#endif
//
// C++0x features in GCC 5.1 and later
//
#if (BOOST_LIBSTDCXX_VERSION < 50100) || !defined(BOOST_LIBSTDCXX11)
# define BOOST_NO_CXX11_HDR_TYPE_TRAITS
# define BOOST_NO_CXX11_HDR_CODECVT
# define BOOST_NO_CXX11_ATOMIC_SMART_PTR
# define BOOST_NO_CXX11_STD_ALIGN
#endif
//
// C++17 features in GCC 6.1 and later
//
#if (BOOST_LIBSTDCXX_VERSION < 60100) || (__cplusplus <= 201402L)
# define BOOST_NO_CXX17_STD_INVOKE
#endif
#if (BOOST_LIBSTDCXX_VERSION < 70100) || (__cplusplus <= 201402L)
# define BOOST_NO_CXX17_STD_APPLY
#endif
#if defined(__has_include)
#if !__has_include(<shared_mutex>)
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#elif __cplusplus <= 201103
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
#elif __cplusplus < 201402 || (BOOST_LIBSTDCXX_VERSION < 40900) || !defined(BOOST_LIBSTDCXX11)
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
#endif
//
// Headers not present on Solaris with the Oracle compiler:
#if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5140)
#define BOOST_NO_CXX11_HDR_FUTURE
#define BOOST_NO_CXX11_HDR_FORWARD_LIST
#define BOOST_NO_CXX11_HDR_ATOMIC
// shared_ptr is present, but is not convertible to bool
// which causes all kinds of problems especially in Boost.Thread
// but probably elsewhere as well.
#define BOOST_NO_CXX11_SMART_PTR
#endif
#if (!defined(_GLIBCXX_HAS_GTHREADS) || !defined(_GLIBCXX_USE_C99_STDINT_TR1))
// Headers not always available:
# ifndef BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
# endif
# ifndef BOOST_NO_CXX11_HDR_MUTEX
# define BOOST_NO_CXX11_HDR_MUTEX
# endif
# ifndef BOOST_NO_CXX11_HDR_THREAD
# define BOOST_NO_CXX11_HDR_THREAD
# endif
# ifndef BOOST_NO_CXX14_HDR_SHARED_MUTEX
# define BOOST_NO_CXX14_HDR_SHARED_MUTEX
# endif
#endif
#if (!defined(_GTHREAD_USE_MUTEX_TIMEDLOCK) || (_GTHREAD_USE_MUTEX_TIMEDLOCK == 0)) && !defined(BOOST_NO_CXX11_HDR_MUTEX)
// Timed mutexes are not always available:
# define BOOST_NO_CXX11_HDR_MUTEX
#endif
// --- end ---
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,639 @@
// Boost string_algo library finder.hpp header file ---------------------------//
// Copyright Pavol Droba 2002-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/ for updates, documentation, and revision history.
#ifndef BOOST_STRING_FINDER_DETAIL_HPP
#define BOOST_STRING_FINDER_DETAIL_HPP
#include <boost/algorithm/string/config.hpp>
#include <boost/algorithm/string/constants.hpp>
#include <boost/detail/iterator.hpp>
#include <boost/range/iterator_range_core.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/empty.hpp>
#include <boost/range/as_literal.hpp>
namespace boost {
namespace algorithm {
namespace detail {
// find first functor -----------------------------------------------//
// find a subsequence in the sequence ( functor )
/*
Returns a pair <begin,end> marking the subsequence in the sequence.
If the find fails, functor returns <End,End>
*/
template<typename SearchIteratorT,typename PredicateT>
struct first_finderF
{
typedef SearchIteratorT search_iterator_type;
// Construction
template< typename SearchT >
first_finderF( const SearchT& Search, PredicateT Comp ) :
m_Search(::boost::begin(Search), ::boost::end(Search)), m_Comp(Comp) {}
first_finderF(
search_iterator_type SearchBegin,
search_iterator_type SearchEnd,
PredicateT Comp ) :
m_Search(SearchBegin, SearchEnd), m_Comp(Comp) {}
// Operation
template< typename ForwardIteratorT >
iterator_range<ForwardIteratorT>
operator()(
ForwardIteratorT Begin,
ForwardIteratorT End ) const
{
typedef iterator_range<ForwardIteratorT> result_type;
typedef ForwardIteratorT input_iterator_type;
// Outer loop
for(input_iterator_type OuterIt=Begin;
OuterIt!=End;
++OuterIt)
{
// Sanity check
if( boost::empty(m_Search) )
return result_type( End, End );
input_iterator_type InnerIt=OuterIt;
search_iterator_type SubstrIt=m_Search.begin();
for(;
InnerIt!=End && SubstrIt!=m_Search.end();
++InnerIt,++SubstrIt)
{
if( !( m_Comp(*InnerIt,*SubstrIt) ) )
break;
}
// Substring matching succeeded
if ( SubstrIt==m_Search.end() )
return result_type( OuterIt, InnerIt );
}
return result_type( End, End );
}
private:
iterator_range<search_iterator_type> m_Search;
PredicateT m_Comp;
};
// find last functor -----------------------------------------------//
// find the last match a subsequence in the sequence ( functor )
/*
Returns a pair <begin,end> marking the subsequence in the sequence.
If the find fails, returns <End,End>
*/
template<typename SearchIteratorT, typename PredicateT>
struct last_finderF
{
typedef SearchIteratorT search_iterator_type;
typedef first_finderF<
search_iterator_type,
PredicateT> first_finder_type;
// Construction
template< typename SearchT >
last_finderF( const SearchT& Search, PredicateT Comp ) :
m_Search(::boost::begin(Search), ::boost::end(Search)), m_Comp(Comp) {}
last_finderF(
search_iterator_type SearchBegin,
search_iterator_type SearchEnd,
PredicateT Comp ) :
m_Search(SearchBegin, SearchEnd), m_Comp(Comp) {}
// Operation
template< typename ForwardIteratorT >
iterator_range<ForwardIteratorT>
operator()(
ForwardIteratorT Begin,
ForwardIteratorT End ) const
{
typedef iterator_range<ForwardIteratorT> result_type;
if( boost::empty(m_Search) )
return result_type( End, End );
typedef BOOST_STRING_TYPENAME boost::detail::
iterator_traits<ForwardIteratorT>::iterator_category category;
return findit( Begin, End, category() );
}
private:
// forward iterator
template< typename ForwardIteratorT >
iterator_range<ForwardIteratorT>
findit(
ForwardIteratorT Begin,
ForwardIteratorT End,
std::forward_iterator_tag ) const
{
typedef iterator_range<ForwardIteratorT> result_type;
first_finder_type first_finder(
m_Search.begin(), m_Search.end(), m_Comp );
result_type M=first_finder( Begin, End );
result_type Last=M;
while( M )
{
Last=M;
M=first_finder( ::boost::end(M), End );
}
return Last;
}
// bidirectional iterator
template< typename ForwardIteratorT >
iterator_range<ForwardIteratorT>
findit(
ForwardIteratorT Begin,
ForwardIteratorT End,
std::bidirectional_iterator_tag ) const
{
typedef iterator_range<ForwardIteratorT> result_type;
typedef ForwardIteratorT input_iterator_type;
// Outer loop
for(input_iterator_type OuterIt=End;
OuterIt!=Begin; )
{
input_iterator_type OuterIt2=--OuterIt;
input_iterator_type InnerIt=OuterIt2;
search_iterator_type SubstrIt=m_Search.begin();
for(;
InnerIt!=End && SubstrIt!=m_Search.end();
++InnerIt,++SubstrIt)
{
if( !( m_Comp(*InnerIt,*SubstrIt) ) )
break;
}
// Substring matching succeeded
if( SubstrIt==m_Search.end() )
return result_type( OuterIt2, InnerIt );
}
return result_type( End, End );
}
private:
iterator_range<search_iterator_type> m_Search;
PredicateT m_Comp;
};
// find n-th functor -----------------------------------------------//
// find the n-th match of a subsequence in the sequence ( functor )
/*
Returns a pair <begin,end> marking the subsequence in the sequence.
If the find fails, returns <End,End>
*/
template<typename SearchIteratorT, typename PredicateT>
struct nth_finderF
{
typedef SearchIteratorT search_iterator_type;
typedef first_finderF<
search_iterator_type,
PredicateT> first_finder_type;
typedef last_finderF<
search_iterator_type,
PredicateT> last_finder_type;
// Construction
template< typename SearchT >
nth_finderF(
const SearchT& Search,
int Nth,
PredicateT Comp) :
m_Search(::boost::begin(Search), ::boost::end(Search)),
m_Nth(Nth),
m_Comp(Comp) {}
nth_finderF(
search_iterator_type SearchBegin,
search_iterator_type SearchEnd,
int Nth,
PredicateT Comp) :
m_Search(SearchBegin, SearchEnd),
m_Nth(Nth),
m_Comp(Comp) {}
// Operation
template< typename ForwardIteratorT >
iterator_range<ForwardIteratorT>
operator()(
ForwardIteratorT Begin,
ForwardIteratorT End ) const
{
if(m_Nth>=0)
{
return find_forward(Begin, End, m_Nth);
}
else
{
return find_backward(Begin, End, -m_Nth);
}
}
private:
// Implementation helpers
template< typename ForwardIteratorT >
iterator_range<ForwardIteratorT>
find_forward(
ForwardIteratorT Begin,
ForwardIteratorT End,
unsigned int N) const
{
typedef iterator_range<ForwardIteratorT> result_type;
// Sanity check
if( boost::empty(m_Search) )
return result_type( End, End );
// Instantiate find functor
first_finder_type first_finder(
m_Search.begin(), m_Search.end(), m_Comp );
result_type M( Begin, Begin );
for( unsigned int n=0; n<=N; ++n )
{
// find next match
M=first_finder( ::boost::end(M), End );
if ( !M )
{
// Subsequence not found, return
return M;
}
}
return M;
}
template< typename ForwardIteratorT >
iterator_range<ForwardIteratorT>
find_backward(
ForwardIteratorT Begin,
ForwardIteratorT End,
unsigned int N) const
{
typedef iterator_range<ForwardIteratorT> result_type;
// Sanity check
if( boost::empty(m_Search) )
return result_type( End, End );
// Instantiate find functor
last_finder_type last_finder(
m_Search.begin(), m_Search.end(), m_Comp );
result_type M( End, End );
for( unsigned int n=1; n<=N; ++n )
{
// find next match
M=last_finder( Begin, ::boost::begin(M) );
if ( !M )
{
// Subsequence not found, return
return M;
}
}
return M;
}
private:
iterator_range<search_iterator_type> m_Search;
int m_Nth;
PredicateT m_Comp;
};
// find head/tail implementation helpers ---------------------------//
template<typename ForwardIteratorT>
iterator_range<ForwardIteratorT>
find_head_impl(
ForwardIteratorT Begin,
ForwardIteratorT End,
unsigned int N,
std::forward_iterator_tag )
{
typedef ForwardIteratorT input_iterator_type;
typedef iterator_range<ForwardIteratorT> result_type;
input_iterator_type It=Begin;
for(
unsigned int Index=0;
Index<N && It!=End; ++Index,++It ) {};
return result_type( Begin, It );
}
template< typename ForwardIteratorT >
iterator_range<ForwardIteratorT>
find_head_impl(
ForwardIteratorT Begin,
ForwardIteratorT End,
unsigned int N,
std::random_access_iterator_tag )
{
typedef iterator_range<ForwardIteratorT> result_type;
if ( (End<=Begin) || ( static_cast<unsigned int>(End-Begin) < N ) )
return result_type( Begin, End );
return result_type(Begin,Begin+N);
}
// Find head implementation
template<typename ForwardIteratorT>
iterator_range<ForwardIteratorT>
find_head_impl(
ForwardIteratorT Begin,
ForwardIteratorT End,
unsigned int N )
{
typedef BOOST_STRING_TYPENAME boost::detail::
iterator_traits<ForwardIteratorT>::iterator_category category;
return ::boost::algorithm::detail::find_head_impl( Begin, End, N, category() );
}
template< typename ForwardIteratorT >
iterator_range<ForwardIteratorT>
find_tail_impl(
ForwardIteratorT Begin,
ForwardIteratorT End,
unsigned int N,
std::forward_iterator_tag )
{
typedef ForwardIteratorT input_iterator_type;
typedef iterator_range<ForwardIteratorT> result_type;
unsigned int Index=0;
input_iterator_type It=Begin;
input_iterator_type It2=Begin;
// Advance It2 by N increments
for( Index=0; Index<N && It2!=End; ++Index,++It2 ) {};
// Advance It, It2 to the end
for(; It2!=End; ++It,++It2 ) {};
return result_type( It, It2 );
}
template< typename ForwardIteratorT >
iterator_range<ForwardIteratorT>
find_tail_impl(
ForwardIteratorT Begin,
ForwardIteratorT End,
unsigned int N,
std::bidirectional_iterator_tag )
{
typedef ForwardIteratorT input_iterator_type;
typedef iterator_range<ForwardIteratorT> result_type;
input_iterator_type It=End;
for(
unsigned int Index=0;
Index<N && It!=Begin; ++Index,--It ) {};
return result_type( It, End );
}
template< typename ForwardIteratorT >
iterator_range<ForwardIteratorT>
find_tail_impl(
ForwardIteratorT Begin,
ForwardIteratorT End,
unsigned int N,
std::random_access_iterator_tag )
{
typedef iterator_range<ForwardIteratorT> result_type;
if ( (End<=Begin) || ( static_cast<unsigned int>(End-Begin) < N ) )
return result_type( Begin, End );
return result_type( End-N, End );
}
// Operation
template< typename ForwardIteratorT >
iterator_range<ForwardIteratorT>
find_tail_impl(
ForwardIteratorT Begin,
ForwardIteratorT End,
unsigned int N )
{
typedef BOOST_STRING_TYPENAME boost::detail::
iterator_traits<ForwardIteratorT>::iterator_category category;
return ::boost::algorithm::detail::find_tail_impl( Begin, End, N, category() );
}
// find head functor -----------------------------------------------//
// find a head in the sequence ( functor )
/*
This functor find a head of the specified range. For
a specified N, the head is a subsequence of N starting
elements of the range.
*/
struct head_finderF
{
// Construction
head_finderF( int N ) : m_N(N) {}
// Operation
template< typename ForwardIteratorT >
iterator_range<ForwardIteratorT>
operator()(
ForwardIteratorT Begin,
ForwardIteratorT End ) const
{
if(m_N>=0)
{
return ::boost::algorithm::detail::find_head_impl( Begin, End, m_N );
}
else
{
iterator_range<ForwardIteratorT> Res=
::boost::algorithm::detail::find_tail_impl( Begin, End, -m_N );
return ::boost::make_iterator_range(Begin, Res.begin());
}
}
private:
int m_N;
};
// find tail functor -----------------------------------------------//
// find a tail in the sequence ( functor )
/*
This functor find a tail of the specified range. For
a specified N, the head is a subsequence of N starting
elements of the range.
*/
struct tail_finderF
{
// Construction
tail_finderF( int N ) : m_N(N) {}
// Operation
template< typename ForwardIteratorT >
iterator_range<ForwardIteratorT>
operator()(
ForwardIteratorT Begin,
ForwardIteratorT End ) const
{
if(m_N>=0)
{
return ::boost::algorithm::detail::find_tail_impl( Begin, End, m_N );
}
else
{
iterator_range<ForwardIteratorT> Res=
::boost::algorithm::detail::find_head_impl( Begin, End, -m_N );
return ::boost::make_iterator_range(Res.end(), End);
}
}
private:
int m_N;
};
// find token functor -----------------------------------------------//
// find a token in a sequence ( functor )
/*
This find functor finds a token specified be a predicate
in a sequence. It is equivalent of std::find algorithm,
with an exception that it return range instead of a single
iterator.
If bCompress is set to true, adjacent matching tokens are
concatenated into one match.
*/
template< typename PredicateT >
struct token_finderF
{
// Construction
token_finderF(
PredicateT Pred,
token_compress_mode_type eCompress=token_compress_off ) :
m_Pred(Pred), m_eCompress(eCompress) {}
// Operation
template< typename ForwardIteratorT >
iterator_range<ForwardIteratorT>
operator()(
ForwardIteratorT Begin,
ForwardIteratorT End ) const
{
typedef iterator_range<ForwardIteratorT> result_type;
ForwardIteratorT It=std::find_if( Begin, End, m_Pred );
if( It==End )
{
return result_type( End, End );
}
else
{
ForwardIteratorT It2=It;
if( m_eCompress==token_compress_on )
{
// Find first non-matching character
while( It2!=End && m_Pred(*It2) ) ++It2;
}
else
{
// Advance by one position
++It2;
}
return result_type( It, It2 );
}
}
private:
PredicateT m_Pred;
token_compress_mode_type m_eCompress;
};
// find range functor -----------------------------------------------//
// find a range in the sequence ( functor )
/*
This functor actually does not perform any find operation.
It always returns given iterator range as a result.
*/
template<typename ForwardIterator1T>
struct range_finderF
{
typedef ForwardIterator1T input_iterator_type;
typedef iterator_range<input_iterator_type> result_type;
// Construction
range_finderF(
input_iterator_type Begin,
input_iterator_type End ) : m_Range(Begin, End) {}
range_finderF(const iterator_range<input_iterator_type>& Range) :
m_Range(Range) {}
// Operation
template< typename ForwardIterator2T >
iterator_range<ForwardIterator2T>
operator()(
ForwardIterator2T,
ForwardIterator2T ) const
{
#if BOOST_WORKAROUND( __MWERKS__, <= 0x3003 )
return iterator_range<const ForwardIterator2T>(this->m_Range);
#else
return m_Range;
#endif
}
private:
iterator_range<input_iterator_type> m_Range;
};
} // namespace detail
} // namespace algorithm
} // namespace boost
#endif // BOOST_STRING_FINDER_DETAIL_HPP
@@ -0,0 +1,155 @@
// Copyright Neil Groves 2009. 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)
//
//
// For more information, see http://www.boost.org/libs/range/
//
#ifndef BOOST_RANGE_ALGORITHM_FIND_FIRST_OF_HPP_INCLUDED
#define BOOST_RANGE_ALGORITHM_FIND_FIRST_OF_HPP_INCLUDED
#include <boost/concept_check.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/concepts.hpp>
#include <boost/range/detail/range_return.hpp>
#include <algorithm>
namespace boost
{
namespace range
{
/// \brief template function find_first_of
///
/// range-based version of the find_first_of std algorithm
///
/// \pre SinglePassRange1 is a model of the SinglePassRangeConcept
/// \pre ForwardRange2 is a model of the ForwardRangeConcept
/// \pre BinaryPredicate is a model of the BinaryPredicateConcept
template< class SinglePassRange1, class ForwardRange2 >
inline BOOST_DEDUCED_TYPENAME disable_if<
is_const<SinglePassRange1>,
BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange1>::type
>::type
find_first_of(SinglePassRange1 & rng1, ForwardRange2 const & rng2)
{
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange1> ));
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange2> ));
return std::find_first_of(boost::begin(rng1),boost::end(rng1),
boost::begin(rng2),boost::end(rng2));
}
/// \overload
template< class SinglePassRange1, class ForwardRange2 >
inline BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange1>::type
find_first_of(const SinglePassRange1& rng1, const ForwardRange2& rng2)
{
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange2> ));
return std::find_first_of(boost::begin(rng1),boost::end(rng1),
boost::begin(rng2),boost::end(rng2));
}
/// \overload
template< class SinglePassRange1, class ForwardRange2, class BinaryPredicate >
inline BOOST_DEDUCED_TYPENAME disable_if<
is_const<SinglePassRange1>,
BOOST_DEDUCED_TYPENAME range_iterator<SinglePassRange1>::type
>::type
find_first_of(SinglePassRange1 & rng1, ForwardRange2 const & rng2, BinaryPredicate pred)
{
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange1> ));
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange2> ));
return std::find_first_of(boost::begin(rng1),boost::end(rng1),
boost::begin(rng2),boost::end(rng2),pred);
}
/// \overload
template< class SinglePassRange1, class ForwardRange2, class BinaryPredicate >
inline BOOST_DEDUCED_TYPENAME range_iterator<const SinglePassRange1>::type
find_first_of(const SinglePassRange1& rng1, const ForwardRange2& rng2, BinaryPredicate pred)
{
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange2> ));
return std::find_first_of(boost::begin(rng1),boost::end(rng1),
boost::begin(rng2),boost::end(rng2),pred);
}
// range return overloads
/// \overload
template< range_return_value re, class SinglePassRange1, class ForwardRange2 >
inline BOOST_DEDUCED_TYPENAME disable_if<
is_const<SinglePassRange1>,
BOOST_DEDUCED_TYPENAME range_return<SinglePassRange1,re>::type
>::type
find_first_of(SinglePassRange1& rng1, const ForwardRange2& rng2)
{
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange1> ));
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange2> ));
return range_return<SinglePassRange1,re>::
pack(std::find_first_of(boost::begin(rng1), boost::end(rng1),
boost::begin(rng2), boost::end(rng2)),
rng1);
}
/// \overload
template< range_return_value re, class SinglePassRange1, class ForwardRange2 >
inline BOOST_DEDUCED_TYPENAME range_return<const SinglePassRange1,re>::type
find_first_of(const SinglePassRange1& rng1, const ForwardRange2& rng2)
{
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange2> ));
return range_return<const SinglePassRange1,re>::
pack(std::find_first_of(boost::begin(rng1), boost::end(rng1),
boost::begin(rng2), boost::end(rng2)),
rng1);
}
/// \overload
template< range_return_value re, class SinglePassRange1, class ForwardRange2,
class BinaryPredicate >
inline BOOST_DEDUCED_TYPENAME disable_if<
is_const<SinglePassRange1>,
BOOST_DEDUCED_TYPENAME range_return<SinglePassRange1,re>::type
>::type
find_first_of(SinglePassRange1 & rng1, const ForwardRange2& rng2,
BinaryPredicate pred)
{
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<SinglePassRange1> ));
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange2> ));
return range_return<SinglePassRange1,re>::
pack(std::find_first_of(boost::begin(rng1), boost::end(rng1),
boost::begin(rng2), boost::end(rng2), pred),
rng1);
}
/// \overload
template< range_return_value re, class SinglePassRange1, class ForwardRange2,
class BinaryPredicate >
inline BOOST_DEDUCED_TYPENAME range_return<const SinglePassRange1,re>::type
find_first_of(const SinglePassRange1 & rng1, const ForwardRange2& rng2,
BinaryPredicate pred)
{
BOOST_RANGE_CONCEPT_ASSERT(( SinglePassRangeConcept<const SinglePassRange1> ));
BOOST_RANGE_CONCEPT_ASSERT(( ForwardRangeConcept<const ForwardRange2> ));
return range_return<const SinglePassRange1,re>::
pack(std::find_first_of(boost::begin(rng1), boost::end(rng1),
boost::begin(rng2), boost::end(rng2), pred),
rng1);
}
} // namespace range
using range::find_first_of;
} // namespace boost
#endif // include guard