@@ -123,7 +123,10 @@ class pg_result_t
123123 std::unique_ptr<PGresult, pg_result_deleter_t > m_result;
124124};
125125
126- namespace {
126+ // Do not use anonymous namespace in header file
127+ // https://wiki.sei.cmu.edu/confluence/display/cplusplus/DCL59-CPP.+Do+not+define+an+unnamed+namespace+in+a+header+file
128+ namespace detail {
129+
127130/* *
128131 * Helper for pg_conn_t::exec_prepared() function. All parameters to
129132 * that function are given to the exec_arg::to_str function which will
@@ -145,7 +148,7 @@ struct exec_arg<char const *>
145148{
146149 constexpr static std::size_t const buffers_needed = 0 ;
147150 static char const *to_str (std::vector<std::string> * /* data*/ ,
148- char const *param)
151+ char const *param) noexcept
149152 {
150153 return param;
151154 }
@@ -156,13 +159,13 @@ struct exec_arg<std::string const &>
156159{
157160 constexpr static std::size_t const buffers_needed = 0 ;
158161 static char const *to_str (std::vector<std::string> * /* data*/ ,
159- std::string const ¶m)
162+ std::string const ¶m) noexcept
160163 {
161164 return param.c_str ();
162165 }
163166};
164167
165- } // anonymous namespace
168+ } // namespace detail
166169
167170/* *
168171 * PostgreSQL connection.
@@ -194,16 +197,16 @@ class pg_conn_t
194197 // so that pointers into the strings in that vector remain valid
195198 // after new parameters have been added.
196199 constexpr auto const total_buffers_needed =
197- (0 + ... + exec_arg<TArgs>::buffers_needed);
200+ (0 + ... + detail:: exec_arg<TArgs>::buffers_needed);
198201 std::vector<std::string> exec_params;
199202 exec_params.reserve (total_buffers_needed);
200203
201204 // This array holds the pointers to all parameter strings, either
202205 // to the original string parameters or to the recently converted
203206 // in the exec_params vector.
204207 std::array<char const *, sizeof ...(params)> param_ptrs = {
205- exec_arg<TArgs>::to_str (&exec_params,
206- std::forward<TArgs>(params))...};
208+ detail:: exec_arg<TArgs>::to_str (&exec_params,
209+ std::forward<TArgs>(params))...};
207210
208211 return exec_prepared_internal (stmt, sizeof ...(params),
209212 param_ptrs.data ());
0 commit comments