Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
d2f1aa02
Commit
d2f1aa02
authored
8 years ago
by
Craig Tiller
Browse files
Options
Downloads
Plain Diff
Merge branch 'c++lame' of github.com:ctiller/grpc into c++lame
parents
8ebb5443
34e04046
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/core/lib/support/memory.h
+5
-5
5 additions, 5 deletions
src/core/lib/support/memory.h
test/core/support/memory_test.cc
+13
-0
13 additions, 0 deletions
test/core/support/memory_test.cc
with
18 additions
and
5 deletions
src/core/lib/support/memory.h
+
5
−
5
View file @
d2f1aa02
...
@@ -31,8 +31,8 @@
...
@@ -31,8 +31,8 @@
*
*
*/
*/
#ifndef GRPC_SUPPORT_MEMORY_H
#ifndef GRPC_
CORE_LIB_
SUPPORT_MEMORY_H
#define GRPC_SUPPORT_MEMORY_H
#define GRPC_
CORE_LIB_
SUPPORT_MEMORY_H
#include
<grpc/support/alloc.h>
#include
<grpc/support/alloc.h>
...
@@ -61,8 +61,8 @@ class DefaultDelete {
...
@@ -61,8 +61,8 @@ class DefaultDelete {
void
operator
()(
T
*
p
)
{
Delete
(
p
);
}
void
operator
()(
T
*
p
)
{
Delete
(
p
);
}
};
};
template
<
typename
T
>
template
<
typename
T
,
typename
Deleter
=
DefaultDelete
<
T
>
>
using
UniquePtr
=
std
::
unique_ptr
<
T
,
Default
Delete
<
T
>
>
;
using
UniquePtr
=
std
::
unique_ptr
<
T
,
Delete
r
>
;
template
<
typename
T
,
typename
...
Args
>
template
<
typename
T
,
typename
...
Args
>
inline
UniquePtr
<
T
>
MakeUnique
(
Args
&&
...
args
)
{
inline
UniquePtr
<
T
>
MakeUnique
(
Args
&&
...
args
)
{
...
@@ -71,4 +71,4 @@ inline UniquePtr<T> MakeUnique(Args&&... args) {
...
@@ -71,4 +71,4 @@ inline UniquePtr<T> MakeUnique(Args&&... args) {
}
// namespace grpc_core
}
// namespace grpc_core
#endif
/* GRPC_SUPPORT_
NEW
_H */
#endif
/* GRPC_
CORE_LIB_
SUPPORT_
MEMORY
_H */
This diff is collapsed.
Click to expand it.
test/core/support/memory_test.cc
+
13
−
0
View file @
d2f1aa02
...
@@ -66,6 +66,19 @@ TEST(MemoryTest, MakeUniqueWithArgTest) {
...
@@ -66,6 +66,19 @@ TEST(MemoryTest, MakeUniqueWithArgTest) {
EXPECT_EQ
(
42
,
*
i
);
EXPECT_EQ
(
42
,
*
i
);
}
}
TEST
(
MemoryTest
,
UniquePtrWithCustomDeleter
)
{
int
n
=
0
;
class
IncrementingDeleter
{
public:
void
operator
()(
int
*
p
)
{
++*
p
;
}
};
{
UniquePtr
<
int
,
IncrementingDeleter
>
p
(
&
n
);
EXPECT_EQ
(
0
,
n
);
}
EXPECT_EQ
(
1
,
n
);
}
}
// namespace testing
}
// namespace testing
}
// namespace grpc_core
}
// namespace grpc_core
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment