@@ -53,7 +53,7 @@ namespace sqlite_orm {
5353 * Function used to get field value from object by mapped member pointer/setter/getter
5454 */
5555 template <class F , class C >
56- const F* get_object_field_pointer (const object_type &obj, C c) {
56+ const F* get_object_field_pointer (const object_type &obj, C c) const {
5757 const F *res = nullptr ;
5858 this ->for_each_column_with_field_type <F>([&res, &c, &obj](auto &col){
5959 using column_type = typename std::remove_reference<decltype (col)>::type;
@@ -90,7 +90,7 @@ namespace sqlite_orm {
9090 /* *
9191 * @return vector of column names of table.
9292 */
93- std::vector<std::string> column_names () {
93+ std::vector<std::string> column_names () const {
9494 std::vector<std::string> res;
9595 this ->for_each_column ([&res](auto &c){
9696 res.push_back (c.name );
@@ -102,22 +102,22 @@ namespace sqlite_orm {
102102 * Calls **l** with every primary key dedicated constraint
103103 */
104104 template <class L >
105- void for_each_primary_key (const L &l) {
105+ void for_each_primary_key (const L &l) const {
106106 iterate_tuple (this ->columns , [&l](auto &column){
107107 using column_type = typename std::decay<decltype (column)>::type;
108108 static_if<internal::is_primary_key<column_type>{}>(l)(column);
109109 });
110110 }
111111
112- std::vector<std::string> composite_key_columns_names () {
112+ std::vector<std::string> composite_key_columns_names () const {
113113 std::vector<std::string> res;
114114 this ->for_each_primary_key ([this , &res](auto &c){
115115 res = this ->composite_key_columns_names (c);
116116 });
117117 return res;
118118 }
119119
120- std::vector<std::string> primary_key_column_names () {
120+ std::vector<std::string> primary_key_column_names () const {
121121 std::vector<std::string> res;
122122 this ->for_each_column_with <constraints::primary_key_t <>>([&res](auto &c){
123123 res.push_back (c.name );
@@ -129,7 +129,7 @@ namespace sqlite_orm {
129129 }
130130
131131 template <class ...Args>
132- std::vector<std::string> composite_key_columns_names (const constraints::primary_key_t <Args...> &pk) {
132+ std::vector<std::string> composite_key_columns_names (const constraints::primary_key_t <Args...> &pk) const {
133133 std::vector<std::string> res;
134134 using pk_columns_tuple = decltype (pk.columns );
135135 res.reserve (std::tuple_size<pk_columns_tuple>::value);
@@ -147,7 +147,7 @@ namespace sqlite_orm {
147147 class F ,
148148 class O ,
149149 typename = typename std::enable_if<std::is_member_pointer<F O::*>::value && !std::is_member_function_pointer<F O::*>::value>::type>
150- std::string find_column_name (F O::*m) {
150+ std::string find_column_name (F O::*m) const {
151151 std::string res;
152152 this ->template for_each_column_with_field_type <F>([&res, m](auto c) {
153153 if (c.member_pointer == m) {
@@ -162,7 +162,7 @@ namespace sqlite_orm {
162162 * @return column name or empty string if nothing found.
163163 */
164164 template <class G >
165- std::string find_column_name (G getter, typename std::enable_if<is_getter<G>::value>::type * = nullptr ) {
165+ std::string find_column_name (G getter, typename std::enable_if<is_getter<G>::value>::type * = nullptr ) const {
166166 std::string res;
167167 using field_type = typename getter_traits<G>::field_type;
168168 this ->template for_each_column_with_field_type <field_type>([&res, getter](auto c) {
@@ -178,7 +178,7 @@ namespace sqlite_orm {
178178 * @return column name or empty string if nothing found.
179179 */
180180 template <class S >
181- std::string find_column_name (S setter, typename std::enable_if<is_setter<S>::value>::type * = nullptr ) {
181+ std::string find_column_name (S setter, typename std::enable_if<is_setter<S>::value>::type * = nullptr ) const {
182182 std::string res;
183183 using field_type = typename setter_traits<S>::field_type;
184184 this ->template for_each_column_with_field_type <field_type>([&res, setter](auto c) {
@@ -211,20 +211,20 @@ namespace sqlite_orm {
211211 * @param l Lambda to be called per column itself. Must have signature like this [] (auto col) -> void {}
212212 */
213213 template <class L >
214- void for_each_column (const L &l) {
214+ void for_each_column (const L &l) const {
215215 iterate_tuple (this ->columns , [&l](auto &column){
216216 using column_type = typename std::decay<decltype (column)>::type;
217217 static_if<internal::is_column<column_type>{}>(l)(column);
218218 });
219219 }
220220
221221 template <class L >
222- void for_each_column_with_constraints (const L &l) {
222+ void for_each_column_with_constraints (const L &l) const {
223223 iterate_tuple (this ->columns , l);
224224 }
225225
226226 template <class F , class L >
227- void for_each_column_with_field_type (const L &l) {
227+ void for_each_column_with_field_type (const L &l) const {
228228 iterate_tuple (this ->columns , [&l](auto &column){
229229 using column_type = typename std::decay<decltype (column)>::type;
230230 static_if<std::is_same<F, typename column_type::field_type>{}>(l)(column);
@@ -238,7 +238,7 @@ namespace sqlite_orm {
238238 * @param l Lambda to be called per column itself. Must have signature like this [] (auto col) -> void {}
239239 */
240240 template <class Op , class L >
241- void for_each_column_with (const L &l) {
241+ void for_each_column_with (const L &l) const {
242242 using tuple_helper::tuple_contains_type;
243243 iterate_tuple (this ->columns , [&l](auto &column){
244244 using column_type = typename std::decay<decltype (column)>::type;
0 commit comments