8247869: Change NONCOPYABLE to delete the operations
Reviewed-by: kbarrett, dholmes
This commit is contained in:
parent
c0542ed85e
commit
fab567666e
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -73,18 +73,12 @@
|
||||
// This file holds all globally used constants & types, class (forward)
|
||||
// declarations and a few frequently used utility functions.
|
||||
|
||||
// Declare the named class to be noncopyable. This macro must be used in
|
||||
// a private part of the class's definition, followed by a semi-colon.
|
||||
// Doing so provides private declarations for the class's copy constructor
|
||||
// and assignment operator. Because these operations are private, most
|
||||
// potential callers will fail to compile because they are inaccessible.
|
||||
// The operations intentionally lack a definition, to provoke link-time
|
||||
// failures for calls from contexts where they are accessible, e.g. from
|
||||
// within the class or from a friend of the class.
|
||||
// Note: The lack of definitions is still not completely bullet-proof, as
|
||||
// an apparent call might be optimized away by copy elision.
|
||||
// For C++11 the declarations should be changed to deleted definitions.
|
||||
#define NONCOPYABLE(C) C(C const&); C& operator=(C const&) /* next token must be ; */
|
||||
// Declare the named class to be noncopyable. This macro must be followed by
|
||||
// a semi-colon. The macro provides deleted declarations for the class's copy
|
||||
// constructor and assignment operator. Because these operations are deleted,
|
||||
// they cannot be defined and potential callers will fail to compile.
|
||||
#define NONCOPYABLE(C) C(C const&) = delete; C& operator=(C const&) = delete /* next token must be ; */
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Printf-style formatters for fixed- and variable-width types as pointers and
|
||||
|
Loading…
x
Reference in New Issue
Block a user