Skip to content

Commit

Permalink
inline namespaces to prevent ODR violations
Browse files Browse the repository at this point in the history
  • Loading branch information
anarthal committed Nov 4, 2024
1 parent a0d2623 commit 8771982
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test/integration/test/snippets/overview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ asio::awaitable<void> dont_run(mysql::any_connection& conn)
}
#endif

inline namespace overview {
//[overview_static_struct
// This must be placed at namespace scope.
// Should contain a member for each field of interest present in our query.
Expand All @@ -68,6 +69,7 @@ struct employee
std::string last_name;
};
//]
} // namespace overview

namespace {

Expand Down
4 changes: 4 additions & 0 deletions test/integration/test/snippets/sql_formatting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ std::string compose_select_query(

} // namespace

inline namespace sql_formatting {
//[sql_formatting_formatter_specialization
// We want to add formatting support for employee
struct employee
Expand All @@ -92,6 +93,9 @@ struct employee
std::string last_name;
std::string company_id;
};
//<-
} // namespace sql_formatting
//->

namespace boost {
namespace mysql {
Expand Down

0 comments on commit 8771982

Please sign in to comment.