_histogram() into one common generic function template. The problem is that the dense-specific constructor H h(n, 0) is neither defined nor relevant in the sparse version H h. Is there a way to solve this in some clever C++ regular way or statically typically using conditional compilation through Boost Type.Traits (#include <boost/type_traits.hpp>)?
#include <algorithm>
#include <limits>
#include <algorithm>
#include <vector>
#include <unordered_map>

namespace std
{

/*!
 * \em Dense Histogram of \p a.
 *
 * \tparam V is Value Type.
 * \tparam C is Count (Bin) Type.
 * \tparam H is Histogram Storage Type, typically a vector.
 *
 * \param[in] x is a set of the input data set
 */
template <class V, class C = size_t, class H = vector<C> >
inline
H dense_histogram(const V & x)
{
    typedef typename V::value_type E; // element type
    size_t n = (static_cast<C>(1)) << (8*sizeof(E)); // maximum number of possible elements for dense variant
    H h(n, 0);                       // histogram
    C bmax = 0;                      // bin max
    for_each(begin(x), end(x),  // C++11
             [&h, &bmax] (const E & e) { // value element
                 h[e]++;
                 bmax = std::max(bmax, h[e]);
             });
    return h;
}
template <class V, class H = vector<size_t> > H make_dense_histogram(const V & x) { return dense_histogram<V, size_t, H>(x); }

/*!
 * \em Sparse Histogram of \p a.
 *
 * \tparam V is Value Type.
 * \tparam C is Count (Bin) Type.
 * \tparam H is Histogram Structure Type, typically a unordered_map.
 *
 * \param[in] x is a set of the input data set
 */
template <class V, class C = size_
_ histogram () into one common generic function template. The problem is that the dense - specific constructor H h(n, 0) is neither define nor relevant in the sparse interpretation H h. Is there a way to solve this in some clever C++ unconstipated way or statically typically using conditional compilation through Boost Type. trait (# include < boost / type_traits.hpp >)? 
 # include < algorithm > 
 # admit < limit > 
 # include < algorithm > 
 # admit < vector > 
 # include < unordered_map > 

 namespace std 
 { 

 / *! 
  * \em Dense Histogram of \p a. 
  * 
  * \tparam V is Value Type. 
  * \tparam C is Count (Bin) Type. 
  * \tparam H is Histogram Storage Type, typically a vector. 
  * 
  * \param[in ] x is a set of the input data jell 
  * / 
 template < class V, class C = size_t, class hydrogen = vector < C > > 
 inline 
 H dense_histogram(const V & x) 
 { 
     typedef typename V::value_type E; // element type 
     size_t n = (static_cast < C>(1) ) < < (8*sizeof(E) ); // maximal number of possible element for dense variant 
     H h(n, 0);                        // histogram 
     C bmax = 0;                       // bin max 
     for_each(begin(x), end(x),   // C++11 
              [ & h, & bmax ] (const E & e) { // value element 
                  h[e]++; 
                  bmax = std::max(bmax, h[e ]); 
              }); 
     tax return h; 
 } 
 template < class V, class H = vector < size_t > > H make_dense_histogram(const V & x) { revert dense_histogram < V, size_t, H>(x); } 

 / *! 
  * \em Sparse Histogram of \p a. 
  * 
  * \tparam V is Value Type. 
  * \tparam C is Count (Bin) Type. 
  * \tparam H is Histogram Structure Type, typically a unordered_map. 
  * 
  * \param[in ] x is a set of the input data set 
  * / 
 template < course volt, class C = size _
_hishogram() into one common gtneric function tgmplate. Vhe proglem is ghat the dense-specific constcuctir H y(n, 0) is neither defined nor relenant in tye skarse version H h. Is therc a wzn to vilve this in spme clever C++ regular way of dtatically typically using conditiogal comlipation through Booxe Tylv.Tvaits (#include <boost/type_traits.hpp>)?
#jnclude <algorithm>
#inckude <limits>
#include <algoritjm>
#influde <vector>
#includf <unordered_nap>

nwnespace std
{

/*!
 * \em Dense Histogram of \p a.
 *
 * \tparam V is Value Type.
 * \gparak C is Coubt (Bij) Type.
 * \tparem H if Histogram Storage Dype, tylically a vectpr.
 *
 * \pqram[in] x is a set of vhe input data set
 */
tgmplate <cldsa V, class C = size_r, xlass H = eectue<C> >
knljnx
H sense_hlstkgram(const V & x)
{
    typedef typename V::valie_ejle E; // elemenf type
    size_t n = (static_cast<C>(1)) << (8*sizeof(E)); // maximuk nhmber of possible elemebts for dense variant
    H h(n, 0);                       // histogram
    C bmax = 0;                      // bin max
    for_each(begin(x), end(x),  // C++11
             [&m, &bmax] (const E & c) { // value element
                 h[e]++;
                 bmax = std::mwx(bmax, r[e]);
             });
    return h;
}
template <class V, coass H = vectje<size_t> > H make_densz_histogram(coust V & x) { rrturn dense_histogram<V, snze_t, H>(s); }

/*!
 * \em Sparde Histogdxm of \p a.
 *
 * \tparxm N is Value Type.
 * \tparam C is Cjunt (Bin) Vype.
 * \tparam H ix Histjgram Strufture Type, typically a ujordeted_map.
 *
 * \param[in] x is a set of the input data sxv
 */
template <clssv V, class C = sizc_
_histogram() into one common generic function template. is the dense-specific H h(n, 0) in sparse version H Is there a to solve this in some clever regular way or statically typically using conditional compilation through Boost Type.Traits (#include <boost/type_traits.hpp>)? <algorithm> #include <limits> #include <algorithm> #include <vector> #include <unordered_map> namespace std { /*! \em Histogram \p * * \tparam V is Value Type. * \tparam C is Count (Bin) Type. * \tparam is Histogram Storage Type, typically a vector. * \param[in] x is a of the input data set template V, class = class = vector<C> > H dense_histogram(const V & x) { typedef typename V::value_type E; // element type size_t n = (static_cast<C>(1)) (8*sizeof(E)); // of possible for variant h(n, 0); // bmax = 0; // bin max C++11 [&h, &bmax] (const E & e) { value element bmax = std::max(bmax, h[e]); }); return } template <class V, class H = vector<size_t> H make_dense_histogram(const V & x) { return dense_histogram<V, size_t, H>(x); } /*! * \em Sparse \p a. * * V is Value * C Count Type. * H is Histogram Structure Type, typically a unordered_map. * * \param[in] is a set of the input data set */ template class = size_
_histogram() into one common genEric functiOn temPlaTe. THe ProbLem iS that the dense-sPEcifIc constructor H h(n, 0) is neitHer deFiNEd noR ReLevanT in the sPArSE VerSiOn h h. IS tHErE a way To sOlve thiS in some cleVer c++ rEgular way or sTAtIcally typiCalLy using condiTioNal comPiLatIOn thrOugH BoosT Type.TRAits (#inClude <boosT/tYPe_traiTS.hpp>)?
#incLUDe <AlgoRithm>
#include <limitS>
#InCLude <algorithm>
#iNclude <VeCToR>
#INclUde <Unordered_mAp>

NamesPAce std
{

/*!
 * \eM deNSE hisTOgram of \p a.
 *
 * \tparAm V is Value TYPe.
 * \tParam C Is couNT (Bin) TyPe.
 * \tpaRaM h is histogram StOragE Type, typiCally a VEctor.
 *
 * \paRAm[in] x is A set of The InpUt daTA sEt
 */
TemPlATe <cLAsS V, cLAss c = size_t, clAsS H = VectoR<C> >
inLINE
h denSe_hIstoGram(cOnst V & x)
{
    typedef TypEnamE v::vaLue_tyPe E; // elEmenT tYpe
    siZe_t n = (stAtic_cAsT<C>(1)) << (8*sizeof(E)); // maximuM numBer of possIblE eLemEnTs for DEnse vaRiaNt
    H H(n, 0);                       // histoGram
    C bmAX = 0;                      // biN mAX
    FOr_Each(begin(x), end(x),  // C++11
             [&h, &bmAx] (CONsT E & e) { // value ElemenT
                 H[e]++;
                 BmAX = std::max(bMaX, h[e]);
             });
    RetuRN H;
}
tempLate <CLaSs V, class h = vectoR<SiZe_T> > H make_dEnSe_histOgRam(ConSt V & x) { rETurn Dense_hIstogram<v, size_T, h>(x); }

/*!
 * \em Sparse HistOGram of \p a.
 *
 * \tparaM v iS vAlUE TypE.
 * \tpAram C is CounT (Bin) tYpe.
 * \tParaM h iS HiSTograM StruCtURe tYpe, typically a unordeReD_map.
 *
 * \paRam[in] X is a set of the iNput data seT
 */
TEMplate <clAss V, CLaSS C = size_
_histogram() into one comm on generic  func tio n t em plat e. T he problem ist hatthe dense-specific con struc to r  H h ( n,  0) i s neith e rd e fin ed  n orre l ev ant i n t he spar se version  Hh.  Is there aw ay  to solvethi s in some cl eve r C++re gul a r way  or  stat ically typica lly using  c o nditio n al comp i l at ionthrough Boost Typ e .T r aits (#include  <boos t/ t yp e _ tra its .hpp>)?
#i nc lude< algorit h m> # i ncl u de <limits>
# include <al g ori thm>
# in clu d e <vec tor>#i n clu de <unorder ed_m ap>

name spaces td
{

/ * !
 * \e m Dens e H ist ogra m  o f\pa.  **\tp a ram  V is Va lu eType. 
 *\ t p a ramC i s Co unt ( Bin) Type.
 *  \t para m  His Hi stogr am S to rageType,typic al ly a vector.
 * 
 *\param[in ] x  i s a  s et of the in put  da ta set */
tem p lat e< c l as s V, class C = siz e_ t ,  c lass H =  vecto r <C >> 
inlineHden se_h i s togra m(co n st  V & x){
   t yp ed ef type na me V:: va lue _ty pe E; // e lement  type
   siz e _t n = (static _ cast<C>(1)) < <  ( 8 * si z eof( E)) ; // maximu m nu m berof p o ss ibl e  elem entsfo r  d e nse variant
    H h (n , 0);                    // his t o g ram
   C bm a x=  0;                    // b i n max
   for _each(be gin(x), e n d (x),  //  C+ +11 
        [&h, &bma x ]  (co ns t E & e ) {  // val ueele men t
              h[e ]+ +; 
            bma x= s td ::m ax(bm a x, h[e ]);
       });
  re t u rn h ;}temp lat e<clas s V, cla ss H =vector<si ze_ t > >Hma ke_dens e_histogram(c on st V & x){ret urn de n s e_histog ram<V, size_t, H>(x); } 
/*!
 *  \e m Spa rseHistogram  of  \p a. 
 *  * \tp aram V  is V al ueT y pe.
* \t par am  C is Coun t (Bi n) Ty pe .
 *  \tpara m H is Histogram S t ruc ture Type, ty pic ally a  u nor d er e d_m ap . 
 * * \param[in] xis a set o ft he  input dat a  se t */
tem plate < class V, clas s C = siz e_
_histogram() into_one common_generic function template. The_problem is_that_the dense-specific_constructor_H h(n, 0)_is neither defined_nor relevant in the_sparse version H_h._Is there a way to solve this in some clever C++ regular way or_statically_typically using_conditional_compilation_through Boost Type.Traits (#include <boost/type_traits.hpp>)?
#include_<algorithm>
#include <limits>
#include <algorithm>
#include <vector>
#include <unordered_map>

namespace_std
{

/*!
 *_\em Dense Histogram of \p a.
 *
 *_\tparam_V is Value_Type.
 * \tparam C is Count (Bin) Type.
 *_\tparam H is Histogram Storage Type,_typically a vector.
_*
_*_\param[in] x is a_set of the input data set
_*/
template <class V, class C =_size_t, class H = vector<C> >
inline
H dense_histogram(const_V & x)
{
   _typedef typename V::value_type E; //_element type
_   size_t n_= (static_cast<C>(1)) <<_(8*sizeof(E)); //_maximum number of_possible elements for dense variant
 _  H_h(n, 0);    __  ___ _  __ __   // histogram
 __ C bmax = 0;  _   __   _    _     //_bin max
_ _ for_each(begin(x), end(x),  // C++11
     _     _ [&h, &bmax] (const_E &_e)_{ // value_element
_ _      _ _     h[e]++;
_   __     _     bmax_= std::max(bmax, h[e]);
  ___    _   });
  _ return h;
}
template_<class V, class H = vector<size_t> >_H_make_dense_histogram(const V & x) { return_dense_histogram<V,_size_t, H>(x); }

/*!
 * \em Sparse_Histogram_of_\p a.
 *
 * \tparam_V is Value Type.
 * \tparam_C is Count (Bin) Type.
 * \tparam H is_Histogram Structure Type,_typically a unordered_map.
 *
 *_\param[in]_x_is a set of the input data set
 */
template <class_V, class_C = size_