Merge "Usage suggestions."
This commit is contained in:
commit
51c2088f3b
15 changed files with 36 additions and 3 deletions
|
@ -17,6 +17,8 @@
|
|||
#ifndef ANDROID_UTILS_ATOMIC_H
|
||||
#define ANDROID_UTILS_ATOMIC_H
|
||||
|
||||
// DO NOT USE: Please instead use std::atomic
|
||||
|
||||
#include <cutils/atomic.h>
|
||||
|
||||
#endif // ANDROID_UTILS_ATOMIC_H
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
/*
|
||||
* Contains some bit manipulation helpers.
|
||||
*
|
||||
* DO NOT USE: std::bitset<32> or std::bitset<64> preferred
|
||||
*/
|
||||
|
||||
namespace android {
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
namespace android {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// DO NOT USE: please use std::condition_variable instead.
|
||||
|
||||
/*
|
||||
* Condition variable class. The implementation is system-dependent.
|
||||
*
|
||||
|
|
|
@ -29,6 +29,8 @@ template<> struct CompileTimeAssert<true> {};
|
|||
#define COMPILE_TIME_ASSERT(_exp) \
|
||||
template class CompileTimeAssert< (_exp) >;
|
||||
#endif
|
||||
|
||||
// DO NOT USE: Please use static_assert instead
|
||||
#define COMPILE_TIME_ASSERT_FUNCTION_SCOPE(_exp) \
|
||||
CompileTimeAssert<( _exp )>();
|
||||
|
||||
|
|
|
@ -33,13 +33,13 @@ class FlattenableUtils {
|
|||
public:
|
||||
template<size_t N>
|
||||
static size_t align(size_t size) {
|
||||
COMPILE_TIME_ASSERT_FUNCTION_SCOPE( !(N & (N-1)) );
|
||||
static_assert(!(N & (N - 1)), "Can only align to a power of 2.");
|
||||
return (size + (N-1)) & ~(N-1);
|
||||
}
|
||||
|
||||
template<size_t N>
|
||||
static size_t align(void const*& buffer) {
|
||||
COMPILE_TIME_ASSERT_FUNCTION_SCOPE( !(N & (N-1)) );
|
||||
static_assert(!(N & (N - 1)), "Can only align to a power of 2.");
|
||||
uintptr_t b = uintptr_t(buffer);
|
||||
buffer = reinterpret_cast<void*>((uintptr_t(buffer) + (N-1)) & ~(N-1));
|
||||
return size_t(uintptr_t(buffer) - b);
|
||||
|
|
|
@ -21,6 +21,10 @@
|
|||
|
||||
namespace android {
|
||||
|
||||
// DO NOT USE: please use
|
||||
// - C++ lambda
|
||||
// - class with well-defined and specific functionality and semantics
|
||||
|
||||
class Functor {
|
||||
public:
|
||||
Functor() {}
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
namespace android {
|
||||
|
||||
// DO NOT USE: please use std::map
|
||||
|
||||
template <typename KEY, typename VALUE>
|
||||
class KeyedVector
|
||||
{
|
||||
|
|
|
@ -37,6 +37,8 @@ namespace android {
|
|||
*
|
||||
* Objects added to the list are copied using the assignment operator,
|
||||
* so this must be defined.
|
||||
*
|
||||
* DO NOT USE: please use std::list<T>
|
||||
*/
|
||||
template<typename T>
|
||||
class List
|
||||
|
|
|
@ -39,6 +39,11 @@ namespace android {
|
|||
#pragma clang diagnostic ignored "-Wundefined-var-template"
|
||||
#endif
|
||||
|
||||
// DO NOT USE: Please use scoped static initialization. For instance:
|
||||
// MyClass& getInstance() {
|
||||
// static MyClass gInstance(...);
|
||||
// return gInstance;
|
||||
// }
|
||||
template <typename TYPE>
|
||||
class ANDROID_API Singleton
|
||||
{
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
namespace android {
|
||||
|
||||
// DO NOT USE: please use std::set
|
||||
|
||||
template <class TYPE>
|
||||
class SortedVector : private SortedVectorImpl
|
||||
{
|
||||
|
|
|
@ -37,6 +37,8 @@ namespace android {
|
|||
|
||||
class String8;
|
||||
|
||||
// DO NOT USE: please use std::u16string
|
||||
|
||||
//! This is a string holding UTF-16 characters.
|
||||
class String16
|
||||
{
|
||||
|
|
|
@ -32,6 +32,8 @@ namespace android {
|
|||
|
||||
class String16;
|
||||
|
||||
// DO NOT USE: please use std::string
|
||||
|
||||
//! This is a string holding UTF-8 characters. Does not allow the value more
|
||||
// than 0x10FFFF, which is not valid unicode codepoint.
|
||||
class String8
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
namespace android {
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
// DO NOT USE: please use std::thread
|
||||
|
||||
class Thread : virtual public RefBase
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -49,6 +49,8 @@ class SortedVector;
|
|||
* The main templated vector class ensuring type safety
|
||||
* while making use of VectorImpl.
|
||||
* This is the class users want to use.
|
||||
*
|
||||
* DO NOT USE: please use std::vector
|
||||
*/
|
||||
|
||||
template <class TYPE>
|
||||
|
|
|
@ -22,7 +22,9 @@
|
|||
|
||||
#include <utils/Endian.h>
|
||||
|
||||
/* get #of elements in a static array */
|
||||
/* get #of elements in a static array
|
||||
* DO NOT USE: please use std::vector/std::array instead
|
||||
*/
|
||||
#ifndef NELEM
|
||||
# define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0])))
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue