Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d9d3e4
commit a2c7201
Showing
15 changed files
with
464 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Copyright Shunsuke Sogame 2005-2007. | ||
# Use, modification, and distribution are 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) | ||
|
||
# For some reason, bjam needs this file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Copyright Shunsuke Sogame 2005-2007. | ||
# Use, modification, and distribution are 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) | ||
|
||
# Thanks to: | ||
# | ||
# Hamigaki Library build settings | ||
|
||
# Copyright Takeshi Mouri 2006, 2007. | ||
# Use, modification, and distribution are 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) | ||
|
||
# Original Copyright | ||
# ============================================================================> | ||
#~ Copyright (C) 2002-2003, David Abrahams. | ||
#~ Copyright (C) 2002-2003, Vladimir Prus. | ||
#~ Copyright (C) 2003, Rene Rivera. | ||
#~ Use, modification and distribution are 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) | ||
# <============================================================================ | ||
|
||
PSTADE_ROOT = $(.boost-build-file:D) ; | ||
boost-build $(BOOST_ROOT)/tools/build/v2 ; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Boost.Range 2.0 Extension library | ||
# via PStade Oven Library | ||
# | ||
# Copyright Akira Takahashi 2011. | ||
# Copyright Shunsuke Sogame 2005-2007. | ||
# 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) | ||
|
||
# bring in rules for testing | ||
import testing ; | ||
|
||
project | ||
: requirements | ||
<link>static | ||
<threading>multi | ||
; | ||
|
||
rule range-test ( name : includes * ) | ||
{ | ||
return [ | ||
run $(name).cpp | ||
: | ||
: | ||
: <toolset>gcc:<cxxflags>"-Wall -Wunused" | ||
] ; | ||
} | ||
|
||
test-suite range_extension : | ||
[ range-test adaptor_test/dropped ] | ||
[ range-test adaptor_test/dropped_while ] | ||
[ range-test adaptor_test/elements ] | ||
[ range-test adaptor_test/elements_key ] | ||
[ range-test adaptor_test/outdirected ] | ||
[ range-test adaptor_test/taken ] | ||
[ range-test adaptor_test/taken_while ] | ||
[ range-test access_test/at ] | ||
[ range-test access_test/back ] | ||
[ range-test access_test/front ] | ||
# [ range-test directory_range ] | ||
[ range-test iteration ] | ||
[ range-test member_select_example ] | ||
[ range-test regular ] | ||
[ range-test regular_example ] | ||
[ range-test regular_operator_example ] | ||
[ range-test single ] | ||
[ range-test split_at ] | ||
; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Boost.Range 2.0 Extension library | ||
// via PStade Oven Library | ||
// | ||
// Copyright Akira Takahashi 2011. | ||
// Copyright Shunsuke Sogame 2005-2007. | ||
// 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) | ||
|
||
#include <iostream> | ||
#include <boost/detail/lightweight_test.hpp> | ||
|
||
#include <boost/range/directory_range.hpp> | ||
|
||
#include <vector> | ||
#include <string> | ||
#include <boost/assign/list_of.hpp> | ||
#include <boost/range/begin.hpp> | ||
#include <boost/range/end.hpp> | ||
#include <boost/range/algorithm/for_each.hpp> | ||
#include <boost/range/algorithm/find.hpp> | ||
|
||
template <class InputIterator, class Pred> | ||
bool all(InputIterator first, InputIterator last, Pred pred) | ||
{ | ||
for (; first != last; ++first) { | ||
if (!pred(*first)) | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
template <class SinglePassRange, class Pred> | ||
bool all(const SinglePassRange& rng, Pred pred) | ||
{ | ||
return all(boost::begin(rng), boost::end(rng), pred); | ||
} | ||
|
||
namespace { | ||
const std::vector<std::string> filenames = boost::assign::list_of | ||
("a.txt") | ||
("b.png") | ||
("c_dir") | ||
; | ||
|
||
const std::vector<std::string> recursive_filenames = boost::assign::list_of | ||
("a.txt") | ||
("b.png") | ||
("c_dir") | ||
("d.cpp") | ||
; | ||
} | ||
|
||
bool exist_check(const boost::filesystem::path& p) | ||
{ | ||
return boost::find(filenames, p.filename()) != boost::end(filenames); | ||
} | ||
|
||
bool recursive_exist_check(const boost::filesystem::path& p) | ||
{ | ||
return boost::find(recursive_filenames, p.filename()) != boost::end(recursive_filenames); | ||
} | ||
|
||
int main() | ||
{ | ||
const boost::filesystem::path path("./directory_range_test_dir"); | ||
|
||
BOOST_TEST(all(boost::directory_range(path), exist_check)); | ||
BOOST_TEST(all(boost::recursive_directory_range(path), recursive_exist_check)); | ||
|
||
return boost::report_errors(); | ||
} |
Empty file.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Boost.Range 2.0 Extension library | ||
// via PStade Oven Library | ||
// | ||
// Copyright Akira Takahashi 2011. | ||
// Copyright Shunsuke Sogame 2005-2007. | ||
// 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) | ||
|
||
#include <iostream> | ||
#include <boost/detail/lightweight_test.hpp> | ||
|
||
#include <boost/range/iteration.hpp> | ||
|
||
#include <vector> | ||
#include <boost/assign/list_of.hpp> | ||
#include <boost/range/adaptor/taken.hpp> | ||
#include <boost/range/adaptor/dropped.hpp> | ||
#include <boost/range/access/front.hpp> | ||
#include <boost/range/algorithm/equal.hpp> | ||
|
||
int next(int x) | ||
{ | ||
return x * 2; | ||
} | ||
|
||
int main() | ||
{ | ||
{ | ||
const std::vector<int> expected = boost::assign::list_of(1)(2)(4)(8)(16); | ||
|
||
BOOST_TEST(boost::equal( | ||
boost::iteration(1, next) | boost::adaptors::taken(5), | ||
expected | ||
)); | ||
} | ||
{ | ||
const int expected = 4; | ||
|
||
BOOST_TEST( | ||
(boost::iteration(1, next) | boost::adaptors::dropped(2) | boost::range::access::front) | ||
== expected | ||
); | ||
} | ||
|
||
return boost::report_errors(); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
// Boost.Range 2.0 Extension library | ||
// via PStade Oven Library | ||
// | ||
// Copyright Akira Takahashi 2011. | ||
// Copyright Shunsuke Sogame 2005-2007. | ||
// 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) | ||
|
||
#include <iostream> | ||
#include <vector> | ||
#include <string> | ||
#include <boost/assign/list_of.hpp> | ||
#include <boost/range/adaptor/regular_extension/transformed.hpp> | ||
#include <boost/range/algorithm/for_each.hpp> | ||
#include <boost/lambda/lambda.hpp> | ||
|
||
struct X { | ||
int a; | ||
std::string s; | ||
|
||
X(int a_, const std::string& s_) : a(a_), s(s_) {} | ||
}; | ||
|
||
struct disper { | ||
template <class T> | ||
void operator()(const T& x) const | ||
{ | ||
std::cout << x << std::endl; | ||
} | ||
}; | ||
|
||
int main() | ||
{ | ||
const std::vector<X> v = boost::assign::list_of | ||
(X(1, "a")) | ||
(X(2, "b")) | ||
(X(3, "c")) | ||
; | ||
|
||
using boost::lambda::_1; | ||
|
||
boost::for_each(v |+ boost::adaptors::transformed(&_1 ->* &X::s), disper()); | ||
} | ||
|
||
/* | ||
a | ||
b | ||
c | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Boost.Range 2.0 Extension library | ||
// via PStade Oven Library | ||
// | ||
// Copyright Akira Takahashi 2011. | ||
// Copyright Shunsuke Sogame 2005-2007. | ||
// 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) | ||
|
||
#include <iostream> | ||
#include <boost/detail/lightweight_test.hpp> | ||
|
||
#include <boost/range/regular.hpp> | ||
#include <boost/lambda/lambda.hpp> | ||
|
||
template< class F > | ||
void regular_check(F const f) | ||
{ | ||
F f1(f); | ||
F f2; // Default Constructible | ||
f2 = f1; // Copy Assignable | ||
} | ||
|
||
int main() | ||
{ | ||
namespace bll = boost::lambda; | ||
::regular_check(boost::regular(bll::_1 != 'c')); | ||
::regular_check(boost::regular(bll::_1 += 1)); | ||
|
||
return boost::report_errors(); | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Boost.Range 2.0 Extension library | ||
// via PStade Oven Library | ||
// | ||
// Copyright Akira Takahashi 2011. | ||
// Copyright Shunsuke Sogame 2005-2007. | ||
// 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) | ||
|
||
#define BOOST_RESULT_OF_USE_DECLTYPE | ||
#include <iostream> | ||
#include <vector> | ||
#include <boost/assign/list_of.hpp> | ||
#include <boost/range/adaptor/transformed.hpp> | ||
#include <boost/range/regular.hpp> | ||
|
||
template <class InputIterator, class F> | ||
void for_each_(InputIterator first, InputIterator last, F f) | ||
{ | ||
InputIterator it; // Default Constructible | ||
it = first; // Copy Assignable | ||
for (; it != last; ++it) { | ||
f(*it); | ||
} | ||
} | ||
|
||
template <class SinglePassRange, class F> | ||
void for_each_(const SinglePassRange& rng, F f) | ||
{ | ||
return for_each_(boost::begin(rng), boost::end(rng), f); | ||
} | ||
|
||
void disp(int x) | ||
{ | ||
std::cout << x << ' '; | ||
} | ||
|
||
int main() | ||
{ | ||
const std::vector<int> v = boost::assign::list_of(1)(2)(3)(4)(5); | ||
for_each_(v | boost::adaptors::transformed(boost::regular([](int x) { return x + 1; })), disp); | ||
} | ||
|
||
/* | ||
2 3 4 5 6 | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.