Commit d07ca2c7 authored by Ilya Prokhorov's avatar Ilya Prokhorov

Fixed by aStyle

parent 264efbb8
......@@ -14,42 +14,42 @@ template <typename T>
class SharedNotNullPointer {
public:
SharedNotNullPointer() {
}
SharedNotNullPointer() {
}
SharedNotNullPointer(shared_ptr<T> rawSharedPointer) {
if (rawSharedPointer.get() == nullptr) {
throwRuntimeException("Excepted not null, but got null shared_ptr at SharedNotNullPointer constructor");
}
this->rawSharedPointer = rawSharedPointer;
};
SharedNotNullPointer(shared_ptr<T> rawSharedPointer) {
if (rawSharedPointer.get() == nullptr) {
throwRuntimeException("Excepted not null, but got null shared_ptr at SharedNotNullPointer constructor");
}
this->rawSharedPointer = rawSharedPointer;
};
shared_ptr<T> sharedPointer() {
return rawSharedPointer;
}
shared_ptr<T> sharedPointer() {
return rawSharedPointer;
}
T* operator->() const {
return get();
}
T* operator->() const {
return get();
}
T* get() const {
if (rawSharedPointer.get() == nullptr) {
throwRuntimeException("Excepted not null, but got null shared_ptr at SharedNotNullPointer getter");
}
if (rawSharedPointer.get() == nullptr) {
throwRuntimeException("Excepted not null, but got null shared_ptr at SharedNotNullPointer getter");
}
return rawSharedPointer.get();
}
private:
shared_ptr<T> rawSharedPointer;
shared_ptr<T> rawSharedPointer;
};
template <typename T, typename... Args>
SharedNotNullPointer<T>
SharedNotNullPointer<T>
MakeSharedNotNullPointer(Args&&... args) {
auto rawSharedPointer = make_shared<T>(forward<Args>(args)...);
auto sharedNotNullPointer = SharedNotNullPointer<T>(rawSharedPointer);
return sharedNotNullPointer;
auto rawSharedPointer = make_shared<T>(forward<Args>(args)...);
auto sharedNotNullPointer = SharedNotNullPointer<T>(rawSharedPointer);
return sharedNotNullPointer;
};
......@@ -61,13 +61,13 @@ using NotNull = SharedNotNullPointer<T>;
template <typename T, typename... Args>
SharedNotNullPointer<T>
make(Args&&... args) {
return MakeSharedNotNullPointer<T>(forward<Args>(args)...);
return MakeSharedNotNullPointer<T>(forward<Args>(args)...);
};
template <typename T, typename... Args>
SharedNotNullPointer<T>
toNotNull(shared_ptr<T> rawSharedPointer) {
return SharedNotNullPointer<T>(rawSharedPointer);
return SharedNotNullPointer<T>(rawSharedPointer);
};
};
......
......@@ -4,6 +4,6 @@
template <typename ...Args>
void unused(Args&& ...args)
{
(void)(sizeof...(args));
(void)(sizeof...(args));
}
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment