9 #ifndef ThePEG_VSelector_H
10 #define ThePEG_VSelector_H
13 #include "ThePEG/Config/ThePEG.h"
20 template <
typename T,
typename WeightType =
double>
54 typedef typename WeightVector::const_iterator
WIterator;
60 typedef typename ObjectVector::iterator
iterator;
94 WeightType
insert(WeightType d,
const T & t) {
95 WeightType newSum =
theSum + d;
96 if ( newSum <=
theSum )
return d;
108 WeightType
reweight(WeightType,
const T &);
116 WeightType
erase(
const T &);
122 void replace(
const T & told,
const T & tnew) {
124 if ( *it == told ) *it = tnew;
138 T &
select(
double rnd,
double * remainder = 0) throw(range_error) {
164 const T &
select(
double rnd,
double * remainder = 0)
const throw(range_error) {
191 template <
typename RNDGEN>
192 T &
select(RNDGEN & rnd)
throw(range_error) {
194 T & t =
select(rnd(), &rem);
211 template <
typename RNDGEN>
212 const T &
select(RNDGEN & rnd)
const throw(range_error) {
214 const T & t =
select(rnd(), &rem);
271 template <
typename OStream>
272 void output(OStream &)
const;
277 template <
typename IStream>
278 void input(IStream &);
314 template <
typename OStream,
typename T,
typename WeightType>
324 template <
typename IStream,
typename T,
typename WeightType>
334 #include "VSelector.tcc"