Hi,
Offically __cplusplus = 201103L means C++11 is supported but in practice I don't know of any compiler that supports every feature of C++11 yet. I would imagine boost has a number of more specific feature tests. The surest way is perhaps to compile small test programs for each feature. If they fail to compile during a "configure" step you assume the feature doesn't work and set macros accordingly when you compile your main code-base. Regards, Bruce. >________________________________ > From: "[email protected]" <[email protected]> >To: [email protected] >Sent: Friday, November 2, 2012 12:13 PM >Subject: [SOCI-users] std::tuple > >Hi all > >I don't know if you have a policy regarding using features unique for c++11 ? > >Also I don't know any good way of detecting the individual compilers for >whether they support and have enabled (a subset of) c++11. > >However the following code appears to work with std::tuple the same way as >boost::tuple. So feel free to use it. > > > >template <typename T0, typename... Trest> struct >type_conversion<std::tuple<T0,Trest...> > >{ >public: > typedef values base_type; > >private: > > template<std::size_t> struct int_{}; // compile-time counter > > static void from_base(base_type const & in, indicator ind, >std::tuple<T0,Trest...> & out, int_<0> ) > { > in >> std::get<0>(out); > } > > template<std::size_t I> static void from_base(base_type const & in, >indicator ind, std::tuple<T0,Trest...> & out, int_<I> ) > { > from_base( in, ind, out, int_<I-1>() ); > in >> std::get<I>(out); > } > >public: > > static void from_base(base_type const & in, indicator ind, >std::tuple<T0,Trest...> & out) > { > from_base( in, ind, out, int_<sizeof...(Trest)>() ); > } >}; > > >A simple usage could then be: > > >soci::session sql; // connection parameters >soci::rowset<std::tuple<int,std::string>> resultset = (sql.prepare << >"select id,name from soci_test"); >for ( auto& record : resultset ) >{ > enum{ID,NAME}; > auto id = std::get<ID>(record); > auto name = std::get<NAME>(record); > std::cout << "ID: " << id << " name: " << name << std::endl; >} > > > > > >------------------------------------------------------------------------------ >LogMeIn Central: Instant, anywhere, Remote PC access and management. >Stay in control, update software, and manage PCs from one command center >Diagnose problems and improve visibility into emerging IT issues >Automate, monitor and manage. Do more in less time with Central >http://p.sf.net/sfu/logmein12331_d2d >_______________________________________________ >Soci-users mailing list >[email protected] >https://lists.sourceforge.net/lists/listinfo/soci-users > > > ------------------------------------------------------------------------------ LogMeIn Central: Instant, anywhere, Remote PC access and management. Stay in control, update software, and manage PCs from one command center Diagnose problems and improve visibility into emerging IT issues Automate, monitor and manage. Do more in less time with Central http://p.sf.net/sfu/logmein12331_d2d _______________________________________________ Soci-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/soci-users
