mirror of
https://github.com/boostorg/optional.git
synced 2026-07-22 13:53:43 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f6e8ce85e3 | |||
| a5ba3b0132 | |||
| ff8afc877c | |||
| 2ded07a196 | |||
| 5c78cdb9c5 | |||
| 72667a6658 | |||
| 94ee9ddc97 | |||
| b683dba9be |
@@ -1,28 +0,0 @@
|
||||
// Copyright (C) 2003, Fernando Luis Cacciola Carballal.
|
||||
//
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/lib/optional for documentation.
|
||||
//
|
||||
// You are welcome to contact the author at:
|
||||
// fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_DETAIL_NONE_T_17SEP2003_HPP
|
||||
#define BOOST_DETAIL_NONE_T_17SEP2003_HPP
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail {
|
||||
|
||||
struct none_helper{};
|
||||
|
||||
typedef int none_helper::*none_t ;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// boost libs/optional/optional_test.cpp source file
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2002
|
||||
// Eric Friedman
|
||||
//
|
||||
// Permission to use, copy, modify, distribute and sell this software
|
||||
// and its documentation for any purpose is hereby granted without fee,
|
||||
// provided that the above copyright notice appears in all copies and
|
||||
// that both the copyright notice and this permission notice appear in
|
||||
// supporting documentation. No representations are made about the
|
||||
// suitability of this software for any purpose. It is provided "as is"
|
||||
// without express or implied warranty.
|
||||
|
||||
#include "boost/optional.hpp"
|
||||
|
||||
#include "boost/test/minimal.hpp"
|
||||
#include "boost/cstdlib.hpp"
|
||||
|
||||
|
||||
boost::optional<double> f(const boost::optional<bool>& return_flag, int arg)
|
||||
{
|
||||
if (!return_flag.empty() && return_flag.get() == true)
|
||||
return double(arg);
|
||||
|
||||
return boost::optional<double>();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// function test_main
|
||||
//
|
||||
int test_main( int, char *[] )
|
||||
{
|
||||
boost::optional<double> result;
|
||||
/* BOOST_TEST((
|
||||
result.empty()
|
||||
));
|
||||
|
||||
result = f(true, 3);
|
||||
BOOST_TEST((
|
||||
!result.empty() && result.get() == 3
|
||||
));
|
||||
|
||||
result = f(false, 3);
|
||||
BOOST_TEST((
|
||||
result.empty()
|
||||
));
|
||||
|
||||
boost::optional<bool> empty_flag;
|
||||
result = f(empty_flag, 3);
|
||||
BOOST_TEST((
|
||||
result.empty()
|
||||
));
|
||||
*/
|
||||
return boost::exit_success;
|
||||
}
|
||||
Reference in New Issue
Block a user