sys_info_internal.h 661 B

123456789101112131415161718192021222324252627282930313233
  1. // Copyright 2013 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef BASE_SYSTEM_SYS_INFO_INTERNAL_H_
  5. #define BASE_SYSTEM_SYS_INFO_INTERNAL_H_
  6. #include "base/macros.h"
  7. namespace base {
  8. namespace internal {
  9. template <typename T, T (*F)(void)>
  10. class LazySysInfoValue {
  11. public:
  12. LazySysInfoValue() : value_(F()) {}
  13. ~LazySysInfoValue() = default;
  14. T value() { return value_; }
  15. private:
  16. const T value_;
  17. DISALLOW_COPY_AND_ASSIGN(LazySysInfoValue);
  18. };
  19. } // namespace internal
  20. } // namespace base
  21. #endif // BASE_SYSTEM_SYS_INFO_INTERNAL_H_