21 #ifndef otbOGRHelpers_h
22 #define otbOGRHelpers_h
28 #include <boost/range/begin.hpp>
29 #include <boost/range/end.hpp>
30 #include "ogr_feature.h"
31 #if defined(__GNUC__) || defined(__clang__)
32 #pragma GCC diagnostic push
33 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
34 #include <boost/range/size.hpp>
35 #pragma GCC diagnostic pop
37 #include <boost/range/size.hpp>
39 #include <boost/mpl/assert.hpp>
40 #include <boost/type_traits/is_same.hpp>
42 #include "cpl_string.h"
45 #include "OTBGdalAdaptersExport.h"
77 template <
class ContainerType>
90 BOOST_MPL_ASSERT((boost::is_same<typename ContainerType::value_type, std::string>));
91 m_raw.reserve(boost::size(strings) + 1);
92 for (
typename ContainerType::const_iterator b = boost::begin(strings), e = boost::end(strings); b != e; ++b)
94 m_raw.push_back(b->c_str());
96 m_raw.push_back(
nullptr);
97 assert(CSLCount(
const_cast<char**
>(&m_raw[0])) ==
static_cast<int>(boost::size(strings)));
105 return m_raw.size() == 1 ? nullptr :
const_cast<char**
>(&m_raw[0]);
141 #endif // otbOGRHelpers_h