Skip to content

Platform: fix missing namespace for SharedPtr #8329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 31, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions platform/SharedPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#include "platform/mbed_critical.h"

namespace mbed {

/** Shared pointer class.
*
* A shared pointer is a "smart" pointer that retains ownership of an object using
Expand Down Expand Up @@ -285,4 +287,10 @@ bool operator!= (U lhs, const SharedPtr<T> &rhs)
return ((T *) lhs != rhs.get());
}

} /* namespace mbed */

#ifndef MBED_NO_GLOBAL_USING_DIRECTIVE
using mbed::SharedPtr;
Copy link

@deepikabhavnani deepikabhavnani Oct 25, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Along with addition of namespace and backward compatibility, we need to make sure we do not corrupt the global namespace hence a small change needed:

using should be under #ifndef MBED_NO_GLOBAL_USING_DIRECTIVE macro.
https://github.com/ARMmbed/mbed-os/pull/7760/files#diff-3716425795ebc1692d5a64771fa4f35eR169

#endif

#endif // __SHAREDPTR_H__