Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
graph-tool
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
40
Issues
40
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tiago Peixoto
graph-tool
Commits
a00ca7fe
Commit
a00ca7fe
authored
Jul 12, 2013
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make alias Sampler default-constructible
parent
4296b96e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
2 deletions
+8
-2
src/graph/generation/sampler.hh
src/graph/generation/sampler.hh
+8
-2
No files found.
src/graph/generation/sampler.hh
View file @
a00ca7fe
...
...
@@ -20,6 +20,7 @@
#include "random.hh"
#include <functional>
#include <boost/mpl/if.hpp>
namespace
graph_tool
{
...
...
@@ -31,7 +32,7 @@ using namespace boost;
// See http://www.keithschwarz.com/darts-dice-coins/ for a very clear
// explanation,
template
<
class
Value
>
template
<
class
Value
,
class
KeepReference
=
mpl
::
true_
>
class
Sampler
{
public:
...
...
@@ -76,6 +77,8 @@ public:
_small
.
clear
();
}
Sampler
()
{}
template
<
class
RNG
>
const
Value
&
sample
(
RNG
&
rng
)
{
...
...
@@ -103,7 +106,10 @@ private:
}
};
const
vector
<
Value
>&
_items
;
typedef
typename
mpl
::
if_
<
KeepReference
,
const
vector
<
Value
>&
,
vector
<
Value
>
>::
type
items_t
;
items_t
_items
;
vector
<
double
>
_probs
;
vector
<
size_t
>
_alias
;
vector
<
size_t
>
_small
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment