webrtc/api/optional.cc
Oskar Sundbom e403212ede Added nullopt and implicit construction to rtc::Optional
Both of these features are in std::optional and the lack
of them is making Optional use in WebRTC more cumbersome.

We are currently looking at using a more fully-fledged library
for some of our standard utility classes. This is merely a
stop-gap measure.

Bug: None
Change-Id: I958a984fa97a42f6e407be1f38662553efeceac4
Reviewed-on: https://webrtc-review.googlesource.com/22920
Commit-Queue: Oskar Sundbom <ossu@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20688}
2017-11-15 15:50:11 +00:00

34 lines
772 B
C++

/*
* Copyright 2016 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "api/optional.h"
namespace rtc {
namespace optional_internal {
#if RTC_HAS_ASAN
void* FunctionThatDoesNothingImpl(void* x) {
return x;
}
#endif
struct NulloptArg {
constexpr NulloptArg() {}
};
static NulloptArg nullopt_arg;
} // namespace optional_internal
const nullopt_t nullopt(rtc::optional_internal::nullopt_arg);
} // namespace rtc