Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 // Copyright (C) 2011 The Libphonenumber Authors | 1 // Copyright (C) 2011 The Libphonenumber Authors |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 30 matching lines...) Expand all Loading... | |
41 instance.reset(new T()); | 41 instance.reset(new T()); |
42 } | 42 } |
43 | 43 |
44 static boost::scoped_ptr<T> instance; | 44 static boost::scoped_ptr<T> instance; |
45 static boost::once_flag flag; | 45 static boost::once_flag flag; |
46 }; | 46 }; |
47 | 47 |
48 template <class T> boost::scoped_ptr<T> Singleton<T>::instance; | 48 template <class T> boost::scoped_ptr<T> Singleton<T>::instance; |
49 template <class T> boost::once_flag Singleton<T>::flag = BOOST_ONCE_INIT; | 49 template <class T> boost::once_flag Singleton<T>::flag = BOOST_ONCE_INIT; |
50 | 50 |
51 } // namespace phonenumbers | |
52 } // namespace i18n | |
53 | |
51 #else // !I18N_PHONENUMBERS_USE_BOOST | 54 #else // !I18N_PHONENUMBERS_USE_BOOST |
52 | 55 |
53 #include "phonenumbers/base/logging.h" | 56 #include "phonenumbers/base/logging.h" |
54 #include "phonenumbers/base/thread_checker.h" | 57 #include "phonenumbers/base/thread_checker.h" |
55 | 58 |
56 #if !defined(__linux__) && !defined(__APPLE__) | 59 #if !defined(__linux__) && !defined(__APPLE__) |
57 | 60 |
58 namespace i18n { | 61 namespace i18n { |
59 namespace phonenumbers { | 62 namespace phonenumbers { |
60 | 63 |
(...skipping 18 matching lines...) Expand all Loading... | |
79 | 82 |
80 private: | 83 private: |
81 const ThreadChecker thread_checker_; | 84 const ThreadChecker thread_checker_; |
82 }; | 85 }; |
83 | 86 |
84 } // namespace phonenumbers | 87 } // namespace phonenumbers |
85 } // namespace i18n | 88 } // namespace i18n |
86 | 89 |
87 #else | 90 #else |
88 #include "phonenumbers/base/memory/singleton_posix.h" | 91 #include "phonenumbers/base/memory/singleton_posix.h" |
89 #endif | 92 #endif // !defined(__linux__) && !defined(__APPLE__) |
lararennie
2013/06/17 10:33:29
Should this endif also have a comment?
pliard1
2013/06/17 11:28:03
Done.
| |
90 | 93 |
91 #endif // !I18N_PHONENUMBERS_USE_BOOST | 94 #endif // !I18N_PHONENUMBERS_USE_BOOST |
lararennie
2013/06/17 10:33:29
Are the // offsets here supposed to be different t
pliard1
2013/06/17 11:28:03
This was unintended, good catch.
| |
92 #endif // I18N_PHONENUMBERS_BASE_MEMORY_SINGLETON_H_ | 95 #endif // I18N_PHONENUMBERS_BASE_MEMORY_SINGLETON_H_ |
LEFT | RIGHT |