diff --git a/vcfpp.h b/vcfpp.h index d865f8a..513ea3a 100644 --- a/vcfpp.h +++ b/vcfpp.h @@ -157,6 +157,16 @@ struct variant_close } }; + +// deleter for bcf header +struct bcf_hdr_close +{ + void operator()(bcf_hdr_t * x) + { + if(x) bcf_hdr_destroy(x); + } +}; + /** * @class BcfHeader * @brief Object represents header of the VCF, offering methods to access and modify the tags @@ -177,8 +187,8 @@ class BcfHeader ~BcfHeader() { - if(hdr) bcf_hrec_destroy(hrec); - if(hrec) bcf_hdr_destroy(hdr); + if(hrec) bcf_hrec_destroy(hrec); + if(hdr) bcf_hdr_destroy(hdr); } /** @brief stream out the header */