Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
Signed-off-by: chaoqin-li1123 <chaoqinli@google.com>
  • Loading branch information
chaoqin-li1123 committed Jun 18, 2021
1 parent cee9834 commit e564aff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 0 additions & 1 deletion envoy/network/address.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,6 @@ class Instance {
};

using InstanceConstSharedPtr = std::shared_ptr<const Instance>;
using InstanceConstPtr = std::unique_ptr<const Instance>;

} // namespace Address
} // namespace Network
Expand Down
5 changes: 3 additions & 2 deletions source/common/network/address_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,15 @@ class InstanceBase : public Instance {
const Type type_;
};

// Create an address instance. Upon failure, return an error status without throwing.
class InstanceFactory {
public:
template <typename InstanceType, typename... Args>
static StatusOr<InstanceConstPtr> createInstancePtr(Args&&... args) {
static StatusOr<InstanceConstSharedPtr> createInstancePtr(Args&&... args) {
absl::Status status;
// Use new instead of make_unique here because the instance constructors are private and must be
// called directly here.
std::unique_ptr<InstanceType> instance(new InstanceType(status, std::forward<Args>(args)...));
std::shared_ptr<InstanceType> instance(new InstanceType(status, std::forward<Args>(args)...));
if (!status.ok()) {
return status;
}
Expand Down

0 comments on commit e564aff

Please sign in to comment.